{"record":{"id":"4a1da91ae3f3553f","repo":"oraios/serena","slug":"project-root-not-found-project-root-4a1da9","errorCode":null,"errorMessage":"Project root not found: {project_root}","messagePattern":"Project root not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/project.py","lineNumber":146,"sourceCode":"        # The backend configuration is fundamentally owned by the agent, so it takes\n        # precedence. (Note: The agent does not necessary honour the project's choice,\n        # as it may be invalid.)\n        if self._agent is not None:\n            return self._agent.get_language_backend()\n        else:\n            return self.serena_config.determine_language_backend(self.project_config)\n\n    @classmethod\n    def load(\n        cls,\n        project_root: str | Path,\n        serena_config: \"SerenaConfig\",\n        autogen: ProjectConfigAutoGenerationMode = ProjectConfigAutoGenerationMode.SYNCHRONOUS,\n    ) -> \"Project\":\n        assert serena_config is not None\n        project_root = Path(project_root).resolve()\n        if not project_root.exists():\n            raise FileNotFoundError(f\"Project root not found: {project_root}\")\n        project_config = ProjectConfig.load(project_root, serena_config=serena_config, autogen=autogen)\n        return Project(project_root=str(project_root), project_config=project_config, serena_config=serena_config)\n\n    def save_config(self) -> None:\n        \"\"\"\n        Saves the current project configuration to disk.\n        \"\"\"\n        self.project_config.save(self.path_to_project_yml())\n\n    def path_to_serena_data_folder(self) -> str:\n        return self._serena_data_folder\n\n    def path_to_project_yml(self) -> str:\n        return self.serena_config.get_project_yml_location(self.project_root)\n\n    def is_trusted(self) -> bool:\n        \"\"\"\n        Checks whether the project is trusted, based on the global configuration.","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/project.py#L128-L164","documentation":"Raised by Project.load in src/serena/project.py:146 when the resolved project root path does not exist on disk. The loader resolves the path via Path.resolve() and bails out before attempting to load or auto-generate the project configuration.","triggerScenarios":"Calling Project.load with a project_root that is misspelled, was deleted or moved, or is a relative path resolved against an unexpected working directory.","commonSituations":"Passing a path from stale config after a checkout was renamed; mounting the repository at a different location in CI; relative paths resolved against a different CWD in tools/agents.","solutions":["Verify the directory exists: os.path.isdir('/abs/path/to/project') before calling load","Pass an absolute, resolved path (Path(path).resolve()) instead of a relative one","Fix or update the path stored in whatever config/script supplies project_root"],"exampleFix":"// before\nproject = Project.load('~/projects/myrepo', serena_config=cfg)  # may not exist / not expanded\n// after\nroot = Path('~/projects/myrepo').expanduser().resolve()\nassert root.exists(), f'Missing project root: {root}'\nproject = Project.load(str(root), serena_config=cfg)","handlingStrategy":"validation","validationCode":"root = Path(project_root).expanduser().resolve()\nif not root.is_dir():\n    raise NotADirectoryError(f'Project root missing: {root}')","typeGuard":null,"tryCatchPattern":"try:\n    project = Project.load(project_root, serena_config=cfg)\nexcept FileNotFoundError as e:\n    logging.error('Bad project root: %s', e)\n    raise","preventionTips":["Pass absolute, expanded paths only","Check the directory exists in deployment scripts before loading","Keep configs in sync with actual checkout locations"],"tags":["python","file-not-found","path"],"backgroundTag":"file-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}