{"record":{"id":"1aaa7e1511086482","repo":"oraios/serena","slug":"nixd-failed-to-run-result-stderr","errorCode":null,"errorMessage":"nixd failed to run: {result.stderr}","messagePattern":"nixd failed to run: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/nixd_ls.py","lineNumber":136,"sourceCode":"            nixd_path = self._get_nixd_path()\n            if not nixd_path:\n                log.info(\"nixd not found. Attempting to install...\")\n                nixd_path = self._install_nixd_with_nix()\n\n            if not nixd_path:\n                raise RuntimeError(\n                    \"nixd (Nix Language Server) is not installed.\\n\"\n                    \"Please install nixd using one of the following methods:\\n\"\n                    \"  - Using Nix flakes: nix profile install github:nix-community/nixd\\n\"\n                    \"  - From nixpkgs: nix-env -iA nixpkgs.nixd\\n\"\n                    \"  - On macOS with Homebrew: brew install nixd\\n\\n\"\n                    \"After installation, make sure 'nixd' is in your PATH.\"\n                )\n\n            try:\n                result = subprocess_run([nixd_path, \"--version\"], capture_output=True, text=True, check=False, timeout=5)\n                if result.returncode != 0:\n                    raise RuntimeError(f\"nixd failed to run: {result.stderr}\")\n            except Exception as exc:\n                raise RuntimeError(f\"Failed to verify nixd installation: {exc}\") from exc\n\n            return nixd_path\n\n        def _create_launch_command(self, core_path: str) -> list[str]:\n            \"\"\"Return the nixd stdio launch command.\"\"\"\n            return [core_path]\n\n    def _extend_nix_symbol_range_to_include_semicolon(\n        self, symbol: ls_types.UnifiedSymbolInformation, file_content: str\n    ) -> ls_types.UnifiedSymbolInformation:\n        \"\"\"\n        Extend symbol range to include trailing semicolon for Nix attribute symbols.\n\n        nixd provides ranges that exclude semicolons (expression-level), but serena needs\n        statement-level ranges that include semicolons for proper replacement.\n        \"\"\"","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/nixd_ls.py#L118-L154","documentation":"To validate the install, _get_or_install_core_dependency runs `nixd --version` with a 5s timeout and check=False. A non-zero exit code raises RuntimeError including nixd's stderr, meaning the binary exists but failed to execute.","triggerScenarios":"The resolved nixd path points to a binary that exits non-zero on --version: broken/incompatible build, missing dynamic libraries, wrong-architecture binary, or a shim script that fails.","commonSituations":"Partially interrupted installation; nixd built for a different platform; sandboxed environments where the nix store binary cannot execute; a corrupted nix profile.","solutions":["Run `nixd --version` manually to see the underlying error.","Reinstall nixd: nix profile install github:nix-community/nixd (or brew reinstall nixd).","Remove broken binaries from PATH so the installer produces a fresh nixd."],"exampleFix":"// before\nnixd_path = \"/opt/broken/nixd\"  # exits non-zero\n// after\nnix profile install github:nix-community/nixd  # then verify: nixd --version","handlingStrategy":"try-catch","validationCode":"import subprocess\nr = subprocess.run([\"nixd\", \"--version\"], capture_output=True, text=True)\nassert r.returncode == 0, r.stderr","typeGuard":null,"tryCatchPattern":"try:\n    server = NixdLanguageServer(...)\nexcept RuntimeError as e:\n    if str(e).startswith(\"nixd failed to run\"):\n        reinstall_nixd()\n    else:\n        raise","preventionTips":["Run `nixd --version` manually after install to confirm it executes.","Reinstall nixd if the binary was partially installed or mismatched to the platform.","Check library/arch compatibility in sandboxed environments."],"tags":["nixd","process-exit","verification"],"backgroundTag":"binary-exit-nonzero","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}