{"record":{"id":"82ce8616a3e3fdde","repo":"oraios/serena","slug":"ls-specific-settings-nix-config-path-must-be-a-non","errorCode":null,"errorMessage":"ls_specific_settings.nix.config_path must be a non-empty absolute path","messagePattern":"ls_specific_settings\\.nix\\.config_path must be a non-empty absolute path","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/nixd_ls.py","lineNumber":249,"sourceCode":"                    \"installable\": \"\",\n                },\n            },\n        }\n\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\"","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/nixd_ls.py#L231-L267","documentation":"_load_nixd_settings validates the optional config_path key in ls_specific_settings.nix. If present it must be a non-empty string; an empty, whitespace-only, or non-string value raises ValueError since nixd cannot start without valid settings.","triggerScenarios":"Setting ls_specific_settings.nix.config_path to \"\", \"   \", null-adjacent values, or a non-string (e.g. a number/list) and constructing the nixd language server.","commonSituations":"YAML/JSON config where an empty string placeholder was left in; templating that substitutes a blank value; users confusing null (which yields defaults) with \"\" (which is invalid).","solutions":["Set config_path to a non-empty absolute path to your nixd JSON settings file.","Remove the config_path key entirely to use default nixd settings.","Quote/escape values in your config so templating does not collapse them to an empty string."],"exampleFix":"// before\nls_specific_settings.nix.config_path = \"\"\n// after\nls_specific_settings.nix.config_path = \"/home/user/.config/nixd/nixd.json\"","handlingStrategy":"validation","validationCode":"cp = settings.get(\"ls_specific_settings\", {}).get(\"nix\", {}).get(\"config_path\")\nif cp is not None and (not isinstance(cp, str) or not cp.strip()):\n    raise ValueError(\"config_path must be a non-empty string or omitted entirely\")","typeGuard":"def is_valid_config_path(v) -> bool:\n    return v is None or (isinstance(v, str) and bool(v.strip()))","tryCatchPattern":"try:\n    server = NixdLanguageServer(...)\nexcept ValueError as e:\n    if \"must be a non-empty absolute path\" in str(e):\n        del settings[\"ls_specific_settings\"][\"nix\"][\"config_path\"]  # fall back to defaults\n    else:\n        raise","preventionTips":["Omit config_path entirely (null) instead of setting it to an empty string.","Check templated configs for blank substitutions.","Validate settings files at CI/config-load time."],"tags":["configuration","validation","nixd"],"backgroundTag":"config-validation-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}