{"record":{"id":"337087a07edc2084","repo":"oraios/serena","slug":"relative-path-start-path-not-found","errorCode":null,"errorMessage":"Relative path {start_path} not found.","messagePattern":"Relative path (.+?) not found\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/serena/project.py","lineNumber":355,"sourceCode":"        if FileProxy.is_external_path(relative_path):\n            return\n\n        if not self.is_path_in_project(relative_path):\n            raise ValueError(f\"{relative_path=} points outside the project root ({self.project_root})\")\n\n        if require_not_ignored:\n            if self.is_ignored_path(relative_path):\n                raise ValueError(f\"Path {relative_path} is ignored\")\n\n    def gather_source_files(self, relative_path: str = \"\") -> list[str]:\n        \"\"\"Retrieves relative paths of all source files, optionally limited to the given path\n\n        :param relative_path: if provided, restrict search to this path\n        \"\"\"\n        rel_file_paths = []\n        start_path = os.path.join(self.project_root, relative_path)\n        if not os.path.exists(start_path):\n            raise FileNotFoundError(f\"Relative path {start_path} not found.\")\n        if os.path.isfile(start_path):\n            return [relative_path]\n        else:\n            for root, dirs, files in os.walk(start_path, followlinks=True):\n                # prevent recursion into ignored directories\n                dirs[:] = [d for d in dirs if not self.is_ignored_path(os.path.join(root, d))]\n\n                # collect non-ignored files\n                for file in files:\n                    abs_file_path = os.path.join(root, file)\n                    try:\n                        if not self.is_ignored_path(abs_file_path, ignore_non_source_files=True):\n                            try:\n                                rel_file_path = os.path.relpath(abs_file_path, start=self.project_root)\n                            except Exception:\n                                log.warning(\n                                    \"Ignoring path '%s' because it appears to be outside of the project root (%s)\",\n                                    abs_file_path,","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/project.py#L337-L373","documentation":"Raised by Project.gather_source_files (src/serena/project.py:355) when the start path (project_root joined with the given relative_path) does not exist on disk. Gather enumerates source files under this path, so it must be an existing file or directory.","triggerScenarios":"Calling gather_source_files with a relative path to a deleted/moved file or directory, or an empty directory reference removed after a rebuild; also triggered indirectly by indexing/health-check callers when project files vanished.","commonSituations":"Stale cached paths after a refactor; case-mismatched directory names on case-sensitive filesystems; git checkout switching removed a folder just before indexing.","solutions":["Verify the path exists: os.path.exists(os.path.join(project.project_root, relative_path)) before calling","Call with the default '' (whole project root) or an existing subdirectory","Refresh the caller's cached path list before re-indexing"],"exampleFix":"// before\nfiles = project.gather_source_files('src/old_module')  # deleted\n// after\nstart = os.path.join(project.project_root, 'src/old_module')\nfiles = project.gather_source_files('src/old_module') if os.path.exists(start) else project.gather_source_files()","handlingStrategy":"validation","validationCode":"start = os.path.join(project.project_root, relative_path)\nif not os.path.exists(start):\n    raise FileNotFoundError(f'Cannot gather: {start} missing')","typeGuard":null,"tryCatchPattern":"try:\n    files = project.gather_source_files(relative_path)\nexcept FileNotFoundError:\n    files = project.gather_source_files()  # fall back to whole project","preventionTips":["Refresh cached path lists before indexing","Handle case-sensitive filesystems correctly","Re-check paths after branch switches or rebuilds"],"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"}