{"record":{"id":"6ac640d919e77624","repo":"oraios/serena","slug":"failed-to-verify-nixd-installation-exc","errorCode":null,"errorMessage":"Failed to verify nixd installation: {exc}","messagePattern":"Failed to verify nixd installation: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/nixd_ls.py","lineNumber":138,"sourceCode":"                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        \"\"\"\n        range_info = symbol[\"range\"]\n        end_line = range_info[\"end\"][\"line\"]","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/nixd_ls.py#L120-L156","documentation":"Any exception raised while verifying nixd (timeout of the 5-second version check, OS error spawning the process, or the RuntimeError from a non-zero exit) is caught and re-raised as RuntimeError(\"Failed to verify nixd installation: ...\") with the original exception chained.","triggerScenarios":"`nixd --version` hangs longer than 5 seconds; the nixd path is not executable (PermissionError); the binary is missing after a race; subprocess spawn fails.","commonSituations":"Slow first execution while Nix builds/realizes the store path (timeout); nixd installed without execute permission; network-sandboxed CI where nix tries to fetch during the version check.","solutions":["Pre-build nixd before starting the server (run `nixd --version` once manually) so no network/build happens under the 5s timeout.","chmod +x the nixd binary if it lacks the execute bit.","Reinstall nixd via nix profile install or brew install if the binary is broken."],"exampleFix":"// before\n# first run triggers nix build, exceeding 5s timeout\n// after\nnix profile install github:nix-community/nixd && nixd --version  # warm up before launching","handlingStrategy":"retry","validationCode":"import subprocess\ntry:\n    subprocess.run([\"nixd\", \"--version\"], timeout=10, capture_output=True, check=True)\nexcept subprocess.TimeoutExpired:\n    subprocess.run([\"nix\", \"build\", \"github:nix-community/nixd\"], check=True)  # warm store first","typeGuard":null,"tryCatchPattern":"try:\n    server = NixdLanguageServer(...)\nexcept RuntimeError as e:\n    if str(e).startswith(\"Failed to verify nixd installation\"):\n        subprocess.run([\"nix\", \"profile\", \"install\", \"github:nix-community/nixd\"], check=True)  # retry once\n        server = NixdLanguageServer(...)\n    else:\n        raise","preventionTips":["Warm the Nix store (run nixd once) before starting the server to avoid the 5s timeout.","Ensure the nixd binary has the execute bit.","Avoid network-restricted sandboxes during first nixd launch."],"tags":["nixd","timeout","verification"],"backgroundTag":"binary-verification-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}