oraios/serena · error · FileNotFoundError

`clojure` not found. Please install the official Clojure CLI

Error message

`clojure` not found.
Please install the official Clojure CLI from:
  https://clojure.org/guides/getting_started

What it means

verify_clojure_cli raises FileNotFoundError when the `clojure` executable (the official Clojure CLI) is not found on PATH. clojure-lsp startup requires the Clojure CLI to compute classpaths, so the library validates its presence before launching the server.

Source

Thrown at src/solidlsp/language_servers/clojure_lsp.py:74

    "objects.githubusercontent.com",
)


def run_command(cmd: list, capture_output: bool = True) -> subprocess.CompletedProcess:
    return subprocess_run(
        cmd,
        capture_output=False,
        stdout=subprocess.PIPE if capture_output else None,
        stderr=subprocess.STDOUT if capture_output else None,
        text=True,
        check=True,
    )


def verify_clojure_cli() -> None:
    install_msg = "Please install the official Clojure CLI from:\n  https://clojure.org/guides/getting_started"
    if shutil.which("clojure") is None:
        raise FileNotFoundError("`clojure` not found.\n" + install_msg)

    help_proc = run_command(["clojure", "--help"])
    if "-Aaliases" not in help_proc.stdout:
        raise RuntimeError("Detected a Clojure executable, but it does not support '-Aaliases'.\n" + install_msg)

    spath_proc = run_command(["clojure", "-Spath"], capture_output=False)
    if spath_proc.returncode != 0:
        raise RuntimeError("`clojure -Spath` failed; please upgrade to Clojure CLI ≥ 1.10.")


class ClojureLSP(SolidLanguageServer):
    """
    Provides a clojure-lsp specific instantiation of the LanguageServer class.

    You can pass the following entries in ``ls_specific_settings["clojure"]``:
        - clojure_lsp_version: Override the pinned clojure-lsp version downloaded
          by Serena (default: the bundled Serena version).
        - source_paths: Explicit list of source paths (repo-root-relative) to

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install the official Clojure CLI per https://clojure.org/guides/getting_started (e.g. brew install clojure/cli/clojure or the Linux install script)
  2. Ensure the install location (e.g. ~/.clojure/bin or /usr/local/bin) is on PATH for the process launching the server
  3. Verify with `which clojure && clojure --help`; note Leiningen does not satisfy this requirement

Example fix

// before
# only lein installed -> FileNotFoundError: `clojure` not found
// after
curl -L https://download.clojure.org/install/linux-install.sh | sudo bash
clojure --version
Defensive patterns

Strategy: validation

Validate before calling

import shutil
assert shutil.which("clojure"), "Install the official Clojure CLI (https://clojure.org/guides/getting_started); Leiningen does not count"

Try / catch

try:
    server = ClojureLSP(...)
except FileNotFoundError as e:
    if "`clojure` not found" in str(e):
        raise SystemExit("Install the official Clojure CLI and ensure it is on PATH, then retry")
    raise

Prevention

When it happens

Trigger: Calling verify_clojure_cli (from _get_or_install_core_dependency or _test_clojure_cli) during clojure-lsp startup when shutil.which('clojure') returns None.

Common situations: Clojure CLI never installed (only Leiningen installed, which provides `lein` but not `clojure`); CLI installed via a tool manager (e.g. deps-edn install script) whose path is not on the server process's PATH; minimal Docker image without the CLI; PATH differs between IDE and shell.

Related errors


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