{"record":{"id":"aebb5900334a220c","repo":"oraios/serena","slug":"file-or-directory-not-found-within-abs-path-aebb59","errorCode":null,"errorMessage":"File or directory not found: {within_abs_path}","messagePattern":"File or directory not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/ls.py","lineNumber":2186,"sourceCode":"                            if \"location\" in node and \"relativePath\" in node[\"location\"]:\n                                path = Path(node[\"location\"][\"relativePath\"])  # type: ignore\n                                if path.is_absolute():\n                                    try:\n                                        path = path.relative_to(self.repository_root_path)\n                                        node[\"location\"][\"relativePath\"] = str(path)\n                                    except Exception:\n                                        pass\n                            if \"children\" in node:\n                                fix_relative_path(node[\"children\"])\n\n                    fix_relative_path(file_root_nodes)\n\n            return result\n\n        if within_relative_path:\n            within_abs_path = os.path.join(self.repository_root_path, within_relative_path)\n            if not os.path.exists(within_abs_path):\n                raise FileNotFoundError(f\"File or directory not found: {within_abs_path}\")\n            if self.is_ignored_path(within_relative_path):\n                raise ValueError(f\"Explicitly requested symbols in '{within_relative_path}' while the path is ignored\")\n            if os.path.isfile(within_abs_path):\n                root_nodes = self.request_document_symbols(within_relative_path).root_symbols\n                return root_nodes\n            else:\n                self.PathWorkspaceStatus.from_abs_resolved_path(Path(within_abs_path).resolve(), self).check_within_workspace_or_raise()\n                return process_directory(within_abs_path)\n        else:\n            full_result = []\n            for root in self.config.get_absolute_workspace_folders(self.repository_root_path):\n                full_result.extend(process_directory(root))\n            return full_result\n\n    @staticmethod\n    def _get_range_from_file_content(file_content: str) -> ls_types.Range:\n        \"\"\"\n        Get the range for the given file.","sourceCodeStart":2168,"sourceCodeEnd":2204,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/ls.py#L2168-L2204","documentation":"FileNotFoundError raised by SolidLanguageServer.request_directory_symbols (or similar overview API) when the within_relative_path parameter, joined onto repository_root_path, does not exist on disk. The library validates existence before querying the language server so callers get a clear filesystem error instead of an empty symbol result.","triggerScenarios":"Calling request_overview/request_directory_symbols-style APIs with within_relative_path pointing to a file or directory that does not exist under repository_root_path — typo in path, file deleted/moved, or using an absolute path where a repo-relative path is expected.","commonSituations":"Passing OS-absolute paths as relative paths, stale paths after a refactor or checkout of another branch, typos like 'src/mian.py', or paths outside the repository root.","solutions":["Verify the path exists relative to repository_root_path before calling: os.path.exists(os.path.join(ls.repository_root_path, rel_path)).","Convert absolute paths to repo-relative: os.path.relpath(abs_path, ls.repository_root_path) (and skip if it starts with '..').","Fix typos or update the path after refactors; confirm cwd/repository_root_path matches what you assume.","Ensure the file has been written/saved before requesting symbols for it."],"exampleFix":"// before\nls.request_directory_symbols(\"src/modle.py\")  # typo\n// after\nrel = \"src/model.py\"\nassert os.path.exists(os.path.join(ls.repository_root_path, rel))\nls.request_directory_symbols(rel)","handlingStrategy":"validation","validationCode":"import os\nabs_p = os.path.join(ls.repository_root_path, rel_path)\nif not os.path.exists(abs_p):\n    raise FileNotFoundError(f\"{rel_path} does not exist under {ls.repository_root_path}\")","typeGuard":"def path_exists_under_repo(root: str, rel: str) -> bool:\n    return os.path.exists(os.path.join(root, rel))","tryCatchPattern":"try:\n    syms = ls.request_directory_symbols(rel_path)\nexcept FileNotFoundError as e:\n    logging.warning(\"path missing: %s\", e)\n    syms = []","preventionTips":["Convert absolute paths to repo-relative with os.path.relpath","Validate path existence before every symbols request","Re-verify paths after branch switches or refactors","Watch filename case on case-sensitive filesystems"],"tags":["filesystem","path","not-found","solidlsp"],"backgroundTag":"file-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}