mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 18:16:43 +00:00
Handle OSError when validating registered project paths on startup
When a registered project path points to a stale or unreachable filesystem (e.g. a disconnected SSHFS mount), `path.exists()` raises `OSError: [Errno 5] Input/output error` instead of returning False. This uncaught exception crashes the entire MCP server on startup, making all Serena tools unavailable. Wrap the `path.exists()` call in a try/except OSError so that inaccessible paths are gracefully skipped with a warning, matching the existing behavior for non-existent paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6a16b5b9e9
commit
e45b90e64e
1 file changed
+6
-1
@@ -826,7 +826,12 @@ class SerenaConfig(SharedConfig):
|
||||
instance.projects = []
|
||||
for path in loaded_commented_yaml["projects"]:
|
||||
path = Path(path).resolve()
|
||||
if not path.exists() or (path.is_dir() and not os.path.isfile(instance.get_project_yml_location(str(path)))):
|
||||
try:
|
||||
path_exists = path.exists()
|
||||
except OSError as e:
|
||||
log.warning(f"Project path {path} is not accessible ({e}), skipping.")
|
||||
continue
|
||||
if not path_exists or (path.is_dir() and not os.path.isfile(instance.get_project_yml_location(str(path)))):
|
||||
log.warning(f"Project path {path} does not exist or no associated project configuration file found, skipping.")
|
||||
continue
|
||||
if path.is_file():
|
||||
|
||||
Reference in new issue
Block a user