oraios/serena · error · ValueError

Path {self.resolve_abs_path} is outside of configured worksp

Error message

Path {self.resolve_abs_path} is outside of configured workspaces. Configured workspaces: {self.ls._abs_workspace_folders_all}.

What it means

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.

Source

Thrown at src/solidlsp/ls.py:1094

            """
            for workspace in ls._abs_workspace_folders_all:
                if path.is_relative_to(workspace):
                    return SolidLanguageServer.PathWorkspaceStatus(
                        ls=ls, is_in_workspace_folder=True, workspace_root=workspace, resolve_abs_path=path
                    )
            return SolidLanguageServer.PathWorkspaceStatus(ls=ls, is_in_workspace_folder=False, resolve_abs_path=path)

        @classmethod
        def from_relative_path(cls, relative_path: str, ls: "SolidLanguageServer") -> "SolidLanguageServer.PathWorkspaceStatus":
            """
            :param relative_path: a relative path from the repository root
            :param ls: the language server instance
            """
            return cls.from_abs_resolved_path(pathlib.Path(ls.repository_root_path, relative_path).resolve(), ls)

        def check_within_workspace_or_raise(self):
            if not self.is_in_workspace_folder:
                raise ValueError(
                    f"Path {self.resolve_abs_path} is outside of configured workspaces. "
                    f"Configured workspaces: {self.ls._abs_workspace_folders_all}."
                )

    def _resolve_file_uri(self, relative_file_path: str) -> str:
        """Construct a canonical file URI from a relative path.

        For cross-workspace paths containing '..', the path is resolved to
        produce a clean URI without '..' segments.
        """
        p = pathlib.Path(os.path.join(self.repository_root_path, relative_file_path))
        if self._path_contains_dots(relative_file_path):
            p = p.resolve()
            self.PathWorkspaceStatus.from_abs_resolved_path(p, self).check_within_workspace_or_raise()
        return p.as_uri()

    def _activate_additional_workspaces(self) -> None:
        """Open a representative file from each additional workspace folder to

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Move the file into one of the configured workspace folders or point repository_root_path/workspace folders at a directory containing it
  2. Use a relative path within the repository instead of an outside absolute path
  3. Resolve symlinks and confirm the real target is inside the workspace (see is_in_workspace_folder)
  4. Update configured workspace folders to include the file's directory

Example fix

// before
f = LSPFileBounds.from_abs_resolved_path(pathlib.Path("/other/repo/src/a.py"), ls)
f.check_within_workspace_or_raise()  # raises
// after
f = LSPFileBounds.from_rel_path("src/a.py", ls)  # inside repository_root_path
f.check_within_workspace_or_raise()  # ok
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
p = Path(file_path).resolve()
ws = Path(ls.repository_root_path).resolve()
if not p.is_relative_to(ws):
    raise ValueError(f"{p} is outside workspace {ws}")

Try / catch

try:
    f.check_within_workspace_or_raise()
except ValueError as e:
    print(f"Skipping out-of-workspace file: {e}")

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/0c380d816e03d331. Report an issue: GitHub.