{"record":{"id":"4574d009e29a86c5","repo":"oraios/serena","slug":"error-path-does-not-exist-project-root","errorCode":null,"errorMessage":"Error: Path does not exist: {project_root}","messagePattern":"Error: Path does not exist: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/config/serena_config.py","lineNumber":1264,"sourceCode":"        \"\"\"\n        self.projects.append(registered_project)\n        self._persist_projects()\n\n    def add_project_from_path(self, project_root: Path | str, asynchronous_autogen: bool = False) -> \"Project\":\n        \"\"\"\n        Adds a new project to the Serena configuration from a given path, auto-generating the project\n        with defaults if it does not exist.\n        Will raise a FileExistsError if a project already exists at the path.\n\n        :param project_root: the path to the project to add\n        :param asynchronous_autogen: whether to use asynchronous auto-generation for the project configuration\n        :return: the project that was added\n        \"\"\"\n        from ..project import Project\n\n        project_root = Path(project_root).resolve()\n        if not project_root.exists():\n            raise FileNotFoundError(f\"Error: Path does not exist: {project_root}\")\n        if not project_root.is_dir():\n            raise FileNotFoundError(f\"Error: Path is not a directory: {project_root}\")\n\n        for already_registered_project in self.projects:\n            if str(already_registered_project.project_root) == str(project_root):\n                raise FileExistsError(\n                    f\"Project with path {project_root} was already added with name '{already_registered_project.project_name}'.\"\n                )\n\n        autogen = ProjectConfigAutoGenerationMode.ASYNCHRONOUS if asynchronous_autogen else ProjectConfigAutoGenerationMode.SYNCHRONOUS\n        project_config = ProjectConfig.load(project_root, serena_config=self, autogen=autogen)\n\n        new_project = Project(\n            project_root=str(project_root),\n            project_config=project_config,\n            is_newly_created=True,\n            serena_config=self,\n        )","sourceCodeStart":1246,"sourceCodeEnd":1282,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/config/serena_config.py#L1246-L1282","documentation":"SerenaConfig.add_project_from_path() resolves the given project_root to an absolute path and requires it to exist before registering it. If the path is missing on disk, it raises FileNotFoundError prefixed with 'Error: Path does not exist'.","triggerScenarios":"Calling add_project_from_path('/nonexistent/dir') or activate_project_from_path_or_name() with a path string that does not exist (typo, deleted/moved repo, wrong mount) — resolved then checked with Path.exists().","commonSituations":"Typo in the project path; project moved or deleted after being referenced in tooling; relative path resolved from a different working directory than intended; CI container where the repo is not mounted.","solutions":["Correct the path — print the resolved absolute path and verify it exists with os.path.isdir() before calling.","Add the project only after cloning/creating the repository at that location.","If the project moved, remove the stale registration and re-add with the new path."],"exampleFix":"// before\nconfig.add_project_from_path('~/projcts/app')  # typo, does not exist\n// after\nroot = Path('~/projects/app').expanduser().resolve()\nassert root.is_dir()\nconfig.add_project_from_path(root)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nroot = Path(project_root).expanduser().resolve()\nif not root.exists():\n    raise SystemExit(f'project path missing: {root}')","typeGuard":"def is_existing_path(p) -> bool:\n    from pathlib import Path\n    try:\n        return Path(p).expanduser().resolve().exists()\n    except OSError:\n        return False","tryCatchPattern":"try:\n    config.add_project_from_path(project_root)\nexcept FileNotFoundError as e:\n    log.error('cannot add project: %s', e)  # create/mount the repo, then retry","preventionTips":["Expand ~ and resolve relative paths before passing them","Verify repo mounts/paths in CI before invoking Serena","Confirm the project exists at the exact path after moves or re-clones"],"tags":["filesystem","file-not-found","path","python"],"backgroundTag":"path-does-not-exist","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}