diff --git a/src/fileutils.cpp b/src/fileutils.cpp
index 821e97d8d09f869a1740c9f5d0f1e23ec3bcd02f..4efe51b9b1be21b677de8343e308623c976cbc69 100644
--- a/src/fileutils.cpp
+++ b/src/fileutils.cpp
@@ -322,9 +322,13 @@ std::vector<uint8_t>
 loadCacheFile(const std::filesystem::path& path, std::chrono::system_clock::duration maxAge)
 {
     // last_write_time throws exception if file doesn't exist
-    auto writeTime = std::filesystem::last_write_time(path);
-    if (decltype(writeTime)::clock::now() - writeTime > maxAge)
-        throw std::runtime_error("file too old");
+    std::error_code ec;
+    auto writeTime = std::filesystem::last_write_time(path, ec);
+    if (ec)
+        throw std::runtime_error("unable to get last write time of file");
+    auto now = decltype(writeTime)::clock::now();
+    if (now - writeTime > maxAge)
+        throw std::runtime_error("file too old " + dht::print_time_relative(now, writeTime));
 
     JAMI_LOG("Loading cache file '{}'", path);
     return dhtnet::fileutils::loadFile(path);
@@ -334,9 +338,13 @@ std::string
 loadCacheTextFile(const std::filesystem::path& path, std::chrono::system_clock::duration maxAge)
 {
     // last_write_time throws exception if file doesn't exist
-    auto writeTime = std::filesystem::last_write_time(path);
-    if (decltype(writeTime)::clock::now() - writeTime > maxAge)
-        throw std::runtime_error("file too old");
+    std::error_code ec;
+    auto writeTime = std::filesystem::last_write_time(path, ec);
+    if (ec)
+        throw std::runtime_error("unable to get last write time of file");
+    auto now = decltype(writeTime)::clock::now();
+    if (now - writeTime > maxAge)
+        throw std::runtime_error("file too old " + dht::print_time_relative(now, writeTime));
 
     JAMI_LOG("Loading cache file '{}'", path);
     return loadTextFile(path);
diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index aee2c12b56a353630348697fe1e5d36c11de5dc5..bb2c6f0527a9aaa39f1c9d004a9a323d80d1ac86 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -4239,7 +4239,9 @@ JamiAccount::sendFile(const std::string& conversationId,
                                 "Unable to create symlink for file transfer {} - {}. Copy file",
                                 filelinkPath,
                                 path);
-                            if (!std::filesystem::copy_file(path, filelinkPath)) {
+                            std::error_code ec;
+                            auto success = std::filesystem::copy_file(path, filelinkPath, ec);
+                            if (ec || !success) {
                                 JAMI_ERROR("Unable to copy file for file transfer {} - {}",
                                            filelinkPath,
                                            path);
diff --git a/src/media/media_encoder.cpp b/src/media/media_encoder.cpp
index a3e654831689834cca7ff8d3456312bf61ee1daa..9e834c7d204087f0f8c843778f2c6ed61fded9e9 100644
--- a/src/media/media_encoder.cpp
+++ b/src/media/media_encoder.cpp
@@ -1140,7 +1140,8 @@ MediaEncoder::readConfig(AVCodecContext* encoderCtx)
 {
     auto path = fileutils::get_config_dir() / "encoder.json";
     std::string name = encoderCtx->codec->name;
-    if (std::filesystem::is_regular_file(path)) {
+    std::error_code ec;
+    if (std::filesystem::is_regular_file(path, ec)) {
         JAMI_WARN("encoder.json file found, default settings will be erased");
         try {
             Json::Value root;
diff --git a/src/plugin/jamipluginmanager.cpp b/src/plugin/jamipluginmanager.cpp
index 65a2b1f40f469b5f75bea51f500dd39a32bad40f..27bc57f40445d5c9eb01151a487bbd90e3dbb3a1 100644
--- a/src/plugin/jamipluginmanager.cpp
+++ b/src/plugin/jamipluginmanager.cpp
@@ -127,10 +127,11 @@ bool
 JamiPluginManager::checkPluginCertificatePublicKey(const std::string& oldJplPath, const std::string& newJplPath)
 {
     std::map<std::string, std::string> oldDetails = PluginUtils::parseManifestFile(PluginUtils::manifestPath(oldJplPath), oldJplPath);
+    std::error_code ec;
     if (
         oldDetails.empty() ||
-        !std::filesystem::is_regular_file(oldJplPath + DIR_SEPARATOR_CH + oldDetails["id"] + ".crt") ||
-        !std::filesystem::is_regular_file(newJplPath)
+        !std::filesystem::is_regular_file(oldJplPath + DIR_SEPARATOR_CH + oldDetails["id"] + ".crt", ec) ||
+        !std::filesystem::is_regular_file(newJplPath, ec)
     )
         return false;
     try {
@@ -170,7 +171,8 @@ bool
 JamiPluginManager::checkPluginSignatureFile(const std::string& jplPath)
 {
     // check if the file exists
-    if (!std::filesystem::is_regular_file(jplPath)){
+    std::error_code ec;
+    if (!std::filesystem::is_regular_file(jplPath, ec)){
         return false;
     }
     try {
@@ -255,7 +257,8 @@ int
 JamiPluginManager::installPlugin(const std::string& jplPath, bool force)
 {
     int r {SUCCESS};
-    if (std::filesystem::is_regular_file(jplPath)) {
+    std::error_code ec;
+    if (std::filesystem::is_regular_file(jplPath, ec)) {
         try {
             auto manifestMap = PluginUtils::readPluginManifestFromArchive(jplPath);
             const std::string& name = manifestMap["id"];
diff --git a/src/plugin/pluginsutils.cpp b/src/plugin/pluginsutils.cpp
index 10d98961d868aec72f83a5a218b1faf2ae329861..0d66a5eee9e5edb9576848d35487fff9ed0e06a3 100644
--- a/src/plugin/pluginsutils.cpp
+++ b/src/plugin/pluginsutils.cpp
@@ -351,7 +351,8 @@ getLocales(const std::string& rootPath, const std::string& lang)
 std::map<std::string, std::string>
 processLocaleFile(const std::string& preferenceLocaleFilePath)
 {
-    if (!std::filesystem::is_regular_file(preferenceLocaleFilePath)) {
+    std::error_code ec;
+    if (!std::filesystem::is_regular_file(preferenceLocaleFilePath, ec)) {
         return {};
     }
     std::ifstream file(preferenceLocaleFilePath);