oraios/serena · error · RuntimeError
Failed to verify nixd installation: {exc}
Error message
Failed to verify nixd installation: {exc} What it means
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.
Source
Thrown at src/solidlsp/language_servers/nixd_ls.py:138
log.info("nixd not found. Attempting to install...")
nixd_path = self._install_nixd_with_nix()
if not nixd_path:
raise RuntimeError(
"nixd (Nix Language Server) is not installed.\n"
"Please install nixd using one of the following methods:\n"
" - Using Nix flakes: nix profile install github:nix-community/nixd\n"
" - From nixpkgs: nix-env -iA nixpkgs.nixd\n"
" - On macOS with Homebrew: brew install nixd\n\n"
"After installation, make sure 'nixd' is in your PATH."
)
try:
result = subprocess_run([nixd_path, "--version"], capture_output=True, text=True, check=False, timeout=5)
if result.returncode != 0:
raise RuntimeError(f"nixd failed to run: {result.stderr}")
except Exception as exc:
raise RuntimeError(f"Failed to verify nixd installation: {exc}") from exc
return nixd_path
def _create_launch_command(self, core_path: str) -> list[str]:
"""Return the nixd stdio launch command."""
return [core_path]
def _extend_nix_symbol_range_to_include_semicolon(
self, symbol: ls_types.UnifiedSymbolInformation, file_content: str
) -> ls_types.UnifiedSymbolInformation:
"""
Extend symbol range to include trailing semicolon for Nix attribute symbols.
nixd provides ranges that exclude semicolons (expression-level), but serena needs
statement-level ranges that include semicolons for proper replacement.
"""
range_info = symbol["range"]
end_line = range_info["end"]["line"]View on GitHub (pinned to 7fcbca7e62)
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.
Example fix
// before # first run triggers nix build, exceeding 5s timeout // after nix profile install github:nix-community/nixd && nixd --version # warm up before launching
Defensive patterns
Strategy: retry
Validate before calling
import subprocess
try:
subprocess.run(["nixd", "--version"], timeout=10, capture_output=True, check=True)
except subprocess.TimeoutExpired:
subprocess.run(["nix", "build", "github:nix-community/nixd"], check=True) # warm store first Try / catch
try:
server = NixdLanguageServer(...)
except RuntimeError as e:
if str(e).startswith("Failed to verify nixd installation"):
subprocess.run(["nix", "profile", "install", "github:nix-community/nixd"], check=True) # retry once
server = NixdLanguageServer(...)
else:
raise Prevention
- 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.
When it happens
Trigger: `nixd --version` hangs longer than 5 seconds; the nixd path is not executable (PermissionError); the binary is missing after a race; subprocess spawn fails.
Common situations: 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.
Related errors
- nixd failed to run: {result.stderr}
- Request to {url} timed out: {e}
- Tool timeout must be at least 10 seconds, but is {tool_timeo
- Failed to initialize C# language server for {self.repository
- LanguageServer.jl installation timed out. Please install man
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/6ac640d919e77624.
Report an issue: GitHub.