diff --git a/swh/core/config.py b/swh/core/config.py
index 5a9cf8082e6a76c655bfe31921df9bcc9c168301..9245dd5059eb3882133347a0f053c83ddff594d9 100644
--- a/swh/core/config.py
+++ b/swh/core/config.py
@@ -62,7 +62,7 @@ def exists_accessible(filepath: str) -> bool:
         os.stat(filepath)
     except PermissionError:
         raise
-    except FileNotFoundError:
+    except (FileNotFoundError, NotADirectoryError):
         return False
     else:
         if os.access(filepath, os.R_OK):