oraios/serena · error · ValueError
Explicitly requested symbols in '{within_relative_path}' whi
Error message
Explicitly requested symbols in '{within_relative_path}' while the path is ignored What it means
ValueError raised when a caller explicitly passes within_relative_path to a symbols-request API but that path is matched by the server's ignore rules (gitignore/ignore-path filtering). The library refuses to return ignored content on explicit requests rather than silently honoring or ignoring the request.
Source
Thrown at src/solidlsp/ls.py:2188
if path.is_absolute():
try:
path = path.relative_to(self.repository_root_path)
node["location"]["relativePath"] = str(path)
except Exception:
pass
if "children" in node:
fix_relative_path(node["children"])
fix_relative_path(file_root_nodes)
return result
if within_relative_path:
within_abs_path = os.path.join(self.repository_root_path, within_relative_path)
if not os.path.exists(within_abs_path):
raise FileNotFoundError(f"File or directory not found: {within_abs_path}")
if self.is_ignored_path(within_relative_path):
raise ValueError(f"Explicitly requested symbols in '{within_relative_path}' while the path is ignored")
if os.path.isfile(within_abs_path):
root_nodes = self.request_document_symbols(within_relative_path).root_symbols
return root_nodes
else:
self.PathWorkspaceStatus.from_abs_resolved_path(Path(within_abs_path).resolve(), self).check_within_workspace_or_raise()
return process_directory(within_abs_path)
else:
full_result = []
for root in self.config.get_absolute_workspace_folders(self.repository_root_path):
full_result.extend(process_directory(root))
return full_result
@staticmethod
def _get_range_from_file_content(file_content: str) -> ls_types.Range:
"""
Get the range for the given file.
"""
lines = file_content.split("\n")View on GitHub (pinned to 7fcbca7e62)
Solutions
- Request symbols only for non-ignored source files; list non-ignored files instead.
- If the path must be analyzed, remove the corresponding entry from .gitignore or adjust the ignore patterns passed to SolidLanguageServer.create.
- Use ls.is_ignored_path(rel_path) to check before calling and handle gracefully.
- Copy the file to a non-ignored location if you only need one-off analysis.
Example fix
// before
ls.request_directory_symbols("node_modules/pkg/index.js") # ignored
// after
if not ls.is_ignored_path(rel):
ls.request_directory_symbols(rel)
else:
print(f"skipping ignored path {rel}") Defensive patterns
Strategy: validation
Validate before calling
if ls.is_ignored_path(rel_path):
raise ValueError(f"{rel_path} is ignored; pick a tracked source path") Type guard
def is_requestable(ls, rel: str) -> bool:
return os.path.exists(os.path.join(ls.repository_root_path, rel)) and not ls.is_ignored_path(rel) Try / catch
try:
syms = ls.request_directory_symbols(rel_path)
except ValueError as e:
logging.info("ignored path requested: %s", e)
syms = [] Prevention
- Pre-check is_ignored_path for user-supplied paths
- Keep generated/vendor code out of requested paths or un-ignore it deliberately
- Review .gitignore and custom ignore config passed to create()
- Filter file lists through the ignore rules before batch requests
When it happens
Trigger: Calling request_directory_symbols/overview with a path inside .gitignore'd directories (node_modules, build, .venv, dist) or matched by custom ignore patterns configured on the server.
Common situations: Asking for symbols in node_modules or a generated build directory, analyzing vendored/dependency code, or paths ignored by user-custom ignore_config passed at server creation.
Related errors
- The explicitly passed file {within_relative_path} is ignored
- File or directory not found: {within_abs_path}
- File or directory not found: {abs_path}
- Mode file not found: {path.resolve()}
- Error: Path does not exist: {project_root}
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/02708e63b987cf43.
Report an issue: GitHub.