oraios/serena · error · RuntimeError

Failed to install LanguageServer.jl: {result.stderr}

Error message

Failed to install LanguageServer.jl: {result.stderr}

What it means

Raised when the `julia -e 'using Pkg; ...'` install command for LanguageServer.jl exits with a nonzero return code. Serena wraps the subprocess result and surfaces Julia's stderr so the underlying Pkg failure is visible. It is a fatal setup error: without the package, the Julia language server cannot start.

Source

Thrown at src/solidlsp/language_servers/julia_server.py:111

            # Assume it needs installation
            JuliaLanguageServer._install_language_server(julia_path)

        return julia_path

    @staticmethod
    def _install_language_server(julia_path: str) -> None:
        """Install LanguageServer.jl package."""
        log.info("LanguageServer.jl not found. Installing... (this may take a minute)")

        install_cmd = [julia_path, "-e", 'using Pkg; Pkg.add("LanguageServer")']

        try:
            result = subprocess_run(install_cmd, check=False, capture_output=True, text=True, timeout=300)  # 5 minutes for installation

            if result.returncode == 0:
                log.info("LanguageServer.jl installed successfully!")
            else:
                raise RuntimeError(f"Failed to install LanguageServer.jl: {result.stderr}")
        except subprocess.TimeoutExpired:
            raise RuntimeError(
                "LanguageServer.jl installation timed out. Please install manually: julia -e 'using Pkg; Pkg.add(\"LanguageServer\")'"
            )

    @override
    def is_ignored_dirname(self, dirname: str) -> bool:
        """Define language-specific directories to ignore for Julia projects."""
        return super().is_ignored_dirname(dirname) or dirname in [".julia", "build", "dist"]

    @override
    def _supports_pull_diagnostics(self) -> bool:
        # LanguageServer.jl raises an unhandled error on textDocument/diagnostic which crashes
        # the server process. Force the published-diagnostics path instead.
        return False

    @override
    def _get_published_diagnostics_wait_timeout(self, pull_diagnostics_failed: bool) -> float:

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Read `result.stderr` in the message for the actual Pkg error and fix that root cause
  2. Run the manual install: `julia -e 'using Pkg; Pkg.add("LanguageServer")'` to see full output interactively
  3. Verify network/registry access (`julia -e 'using Pkg; Pkg.update()'`) and proxy/firewall settings
  4. Ensure JULIA_DEPOT_PATH is writable or unset so Pkg uses the default depot
  5. Retry Serena's language-server setup after fixing

Example fix

// before: automated install fails silently-ish with stderr only
RuntimeError: Failed to install LanguageServer.jl: ERROR: could not download package ...
// after: pre-install manually in the same depot the server uses
$ julia -e 'using Pkg; Pkg.add("LanguageServer")'
$ export JULIA_DEPOT_PATH=$HOME/.julia  # writable depot
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil, subprocess
assert shutil.which("julia"), "julia not on PATH"
subprocess.run(["julia","-e","using Pkg; Pkg.update()"], check=True, timeout=120)  # verify registry/network works before Serena setup

Try / catch

try:
    server = SolidLSP(JuliaConfig())
except RuntimeError as e:
    if "Failed to install LanguageServer.jl" in str(e):
        log.error("Julia Pkg install failed; fix depot/network, then run: julia -e 'using Pkg; Pkg.add(\"LanguageServer\")'")
        raise

Prevention

When it happens

Trigger: `_setup_runtime_dependency` -> `_install_language_server` runs an install command with `check=False, capture_output=True, timeout=300`; any non-zero exit (Pkg resolution failure, no network/registry access, no writable depot, corrupt Manifest, wrong julia binary) triggers `raise RuntimeError(f"Failed to install LanguageServer.jl: {result.stderr}")`.

Common situations: Offline or firewalled machines that cannot reach the Julia General registry; proxy setups blocking Pkg; JULIA_DEPOT_PATH pointing somewhere unwritable; broken pre-compile cache or Project.toml in the install environment; first-run on a machine where Julia itself is misinstalled.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/f64612e9367d5ab5. Report an issue: GitHub.