oraios/serena · error · ValueError
ls_specific_settings.nix.config_path must be absolute: {conf
Error message
ls_specific_settings.nix.config_path must be absolute: {config_path_value!r} What it means
_load_nixd_settings requires config_path to be absolute (after expanduser). Relative paths are rejected with ValueError because the working directory of the language-server process is not guaranteed, making relative config paths ambiguous.
Source
Thrown at src/solidlsp/language_servers/nixd_ls.py:253
@classmethod
def _load_nixd_settings(cls, custom_settings: SolidLSPSettings.CustomLSSettings) -> dict[str, Any]:
"""Load nixd settings from ``config_path`` or return the built-in defaults.
:param custom_settings: Nix-specific language-server settings.
:return: The value of the nixd configuration section.
:raises ValueError: If ``config_path`` or its JSON document has an invalid shape.
:raises RuntimeError: If the configuration file cannot be read.
"""
config_path_value = custom_settings.get("config_path")
if config_path_value is None:
return cls._create_default_nixd_settings()
if not isinstance(config_path_value, str) or not config_path_value.strip():
raise ValueError("ls_specific_settings.nix.config_path must be a non-empty absolute path")
config_path = Path(config_path_value).expanduser()
if not config_path.is_absolute():
raise ValueError(f"ls_specific_settings.nix.config_path must be absolute: {config_path_value!r}")
try:
with config_path.open(encoding="utf-8") as config_file:
settings = json.load(config_file)
except json.JSONDecodeError as exc:
raise ValueError(
f"Invalid JSON in nixd configuration file '{config_path}': {exc.msg} (line {exc.lineno}, column {exc.colno})"
) from exc
except OSError as exc:
raise RuntimeError(f"Failed to read nixd configuration file '{config_path}': {exc}") from exc
if not isinstance(settings, dict):
raise ValueError(
f"Invalid nixd configuration file '{config_path}': expected a JSON object containing the value of the 'nixd' section"
)
return settings
@staticmethodView on GitHub (pinned to 7fcbca7e62)
Solutions
- Use an absolute path, e.g. /home/user/.config/nixd/nixd.json.
- A leading ~ is allowed: ~/.config/nixd/nixd.json expands before the absolute check.
- In generated configs, resolve the path programmatically (e.g. Path('nixd.json').resolve()) before assigning.
Example fix
// before ls_specific_settings.nix.config_path = "./nixd.json" // after ls_specific_settings.nix.config_path = "/home/user/.config/nixd/nixd.json"
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path(config_path).expanduser()
assert p.is_absolute(), f"config_path must be absolute: {config_path}" Try / catch
try:
server = NixdLanguageServer(...)
except ValueError as e:
if "must be absolute" in str(e):
settings["ls_specific_settings"]["nix"]["config_path"] = str(Path(old_value).expanduser().resolve())
server = NixdLanguageServer(...)
else:
raise Prevention
- Always store absolute paths (or ~/...) in config_path.
- Resolve relative paths programmatically with Path(...).resolve() before assignment.
- Remember ~ is expanded, ./ and ../ are not accepted.
When it happens
Trigger: Setting ls_specific_settings.nix.config_path to a relative path such as "nixd.json" or "./config/nixd.json" and initializing the server.
Common situations: Users copying settings between machines/projects where cwd differs; assuming the config resolves relative to the project root; tilde paths are fine (~ expands) but ./ paths are not.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- ls_specific_settings.nix.config_path must be a non-empty abs
- Unknown language '{lang}'. Supported: {all_langs}
- Cannot use both fixed_tools and excluded_tools/included_opti
- Unknown language backend '{backend_str}': valid values are {
- Invalid line_ending: {value!r}. Valid values are: {valid}
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/1332744384a6d65c.
Report an issue: GitHub.