{"record":{"id":"0c380d816e03d331","repo":"oraios/serena","slug":"path-self-resolve-abs-path-is-outside-of-configu","errorCode":null,"errorMessage":"Path {self.resolve_abs_path} is outside of configured workspaces. Configured workspaces: {self.ls._abs_workspace_folders_all}.","messagePattern":"Path (.+?) is outside of configured workspaces\\. Configured workspaces: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/ls.py","lineNumber":1094,"sourceCode":"            \"\"\"\n            for workspace in ls._abs_workspace_folders_all:\n                if path.is_relative_to(workspace):\n                    return SolidLanguageServer.PathWorkspaceStatus(\n                        ls=ls, is_in_workspace_folder=True, workspace_root=workspace, resolve_abs_path=path\n                    )\n            return SolidLanguageServer.PathWorkspaceStatus(ls=ls, is_in_workspace_folder=False, resolve_abs_path=path)\n\n        @classmethod\n        def from_relative_path(cls, relative_path: str, ls: \"SolidLanguageServer\") -> \"SolidLanguageServer.PathWorkspaceStatus\":\n            \"\"\"\n            :param relative_path: a relative path from the repository root\n            :param ls: the language server instance\n            \"\"\"\n            return cls.from_abs_resolved_path(pathlib.Path(ls.repository_root_path, relative_path).resolve(), ls)\n\n        def check_within_workspace_or_raise(self):\n            if not self.is_in_workspace_folder:\n                raise ValueError(\n                    f\"Path {self.resolve_abs_path} is outside of configured workspaces. \"\n                    f\"Configured workspaces: {self.ls._abs_workspace_folders_all}.\"\n                )\n\n    def _resolve_file_uri(self, relative_file_path: str) -> str:\n        \"\"\"Construct a canonical file URI from a relative path.\n\n        For cross-workspace paths containing '..', the path is resolved to\n        produce a clean URI without '..' segments.\n        \"\"\"\n        p = pathlib.Path(os.path.join(self.repository_root_path, relative_file_path))\n        if self._path_contains_dots(relative_file_path):\n            p = p.resolve()\n            self.PathWorkspaceStatus.from_abs_resolved_path(p, self).check_within_workspace_or_raise()\n        return p.as_uri()\n\n    def _activate_additional_workspaces(self) -> None:\n        \"\"\"Open a representative file from each additional workspace folder to","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/ls.py#L1076-L1112","documentation":"The LSPFileBounds/LSPFile helper's check_within_workspace_or_raise verifies that a resolved absolute path lies inside one of the language server's configured workspace folders. If not, a ValueError is raised naming the offending path and the configured workspaces, because the LS cannot serve documents outside its workspace roots.","triggerScenarios":"Calling check_within_workspace_or_raise on a file helper built from a path outside the repo root/workspace folders; _resolve_file_uri or request_full_symbol_tree encountering such a path.","commonSituations":"Symlinks resolving to paths outside the workspace; absolute paths from another repo passed in; files above the repository root (e.g. ../shared/x.py); misconfigured workspace folders after chdir or repo move.","solutions":["Move the file into one of the configured workspace folders or point repository_root_path/workspace folders at a directory containing it","Use a relative path within the repository instead of an outside absolute path","Resolve symlinks and confirm the real target is inside the workspace (see is_in_workspace_folder)","Update configured workspace folders to include the file's directory"],"exampleFix":"// before\nf = LSPFileBounds.from_abs_resolved_path(pathlib.Path(\"/other/repo/src/a.py\"), ls)\nf.check_within_workspace_or_raise()  # raises\n// after\nf = LSPFileBounds.from_rel_path(\"src/a.py\", ls)  # inside repository_root_path\nf.check_within_workspace_or_raise()  # ok","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(file_path).resolve()\nws = Path(ls.repository_root_path).resolve()\nif not p.is_relative_to(ws):\n    raise ValueError(f\"{p} is outside workspace {ws}\")","typeGuard":null,"tryCatchPattern":"try:\n    f.check_within_workspace_or_raise()\nexcept ValueError as e:\n    print(f\"Skipping out-of-workspace file: {e}\")","preventionTips":["Build file helpers with relative paths inside repository_root_path","Resolve symlinks before validation (targets may escape the workspace)","Keep configured workspace folders in sync with the actual repo layout"],"tags":["workspace","path-validation","security","lsp"],"backgroundTag":"path-outside-workspace","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}