{"record":{"id":"1332744384a6d65c","repo":"oraios/serena","slug":"ls-specific-settings-nix-config-path-must-be-absol","errorCode":null,"errorMessage":"ls_specific_settings.nix.config_path must be absolute: {config_path_value!r}","messagePattern":"ls_specific_settings\\.nix\\.config_path must be absolute: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/nixd_ls.py","lineNumber":253,"sourceCode":"\n    @classmethod\n    def _load_nixd_settings(cls, custom_settings: SolidLSPSettings.CustomLSSettings) -> dict[str, Any]:\n        \"\"\"Load nixd settings from ``config_path`` or return the built-in defaults.\n\n        :param custom_settings: Nix-specific language-server settings.\n        :return: The value of the nixd configuration section.\n        :raises ValueError: If ``config_path`` or its JSON document has an invalid shape.\n        :raises RuntimeError: If the configuration file cannot be read.\n        \"\"\"\n        config_path_value = custom_settings.get(\"config_path\")\n        if config_path_value is None:\n            return cls._create_default_nixd_settings()\n        if not isinstance(config_path_value, str) or not config_path_value.strip():\n            raise ValueError(\"ls_specific_settings.nix.config_path must be a non-empty absolute path\")\n\n        config_path = Path(config_path_value).expanduser()\n        if not config_path.is_absolute():\n            raise ValueError(f\"ls_specific_settings.nix.config_path must be absolute: {config_path_value!r}\")\n\n        try:\n            with config_path.open(encoding=\"utf-8\") as config_file:\n                settings = json.load(config_file)\n        except json.JSONDecodeError as exc:\n            raise ValueError(\n                f\"Invalid JSON in nixd configuration file '{config_path}': {exc.msg} (line {exc.lineno}, column {exc.colno})\"\n            ) from exc\n        except OSError as exc:\n            raise RuntimeError(f\"Failed to read nixd configuration file '{config_path}': {exc}\") from exc\n\n        if not isinstance(settings, dict):\n            raise ValueError(\n                f\"Invalid nixd configuration file '{config_path}': expected a JSON object containing the value of the 'nixd' section\"\n            )\n        return settings\n\n    @staticmethod","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/nixd_ls.py#L235-L271","documentation":"_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.","triggerScenarios":"Setting ls_specific_settings.nix.config_path to a relative path such as \"nixd.json\" or \"./config/nixd.json\" and initializing the server.","commonSituations":"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.","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."],"exampleFix":"// before\nls_specific_settings.nix.config_path = \"./nixd.json\"\n// after\nls_specific_settings.nix.config_path = \"/home/user/.config/nixd/nixd.json\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(config_path).expanduser()\nassert p.is_absolute(), f\"config_path must be absolute: {config_path}\"","typeGuard":null,"tryCatchPattern":"try:\n    server = NixdLanguageServer(...)\nexcept ValueError as e:\n    if \"must be absolute\" in str(e):\n        settings[\"ls_specific_settings\"][\"nix\"][\"config_path\"] = str(Path(old_value).expanduser().resolve())\n        server = NixdLanguageServer(...)\n    else:\n        raise","preventionTips":["Always store absolute paths (or ~/...) in config_path.","Resolve relative paths programmatically with Path(...).resolve() before assignment.","Remember ~ is expanded, ./ and ../ are not accepted."],"tags":["configuration","validation","paths","nixd"],"backgroundTag":"config-validation-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}