oraios/serena · error · RuntimeError

Detected a Clojure executable, but it does not support '-Aal

Error message

Detected a Clojure executable, but it does not support '-Aaliases'.
Please install the official Clojure CLI from:
  https://clojure.org/guides/getting_started

What it means

verify_clojure_cli raises RuntimeError when a `clojure` executable exists on PATH but its `--help` output does not advertise '-Aaliases', indicating it is not a functional official Clojure CLI (wrong shim, ancient CLI, or a lookalike binary). The library uses this probe to validate the CLI before relying on `clojure -Spath`.

Source

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

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
          inject into clojure-lsp's ``initializationOptions``. Skips both the
          ``.lsp/config.edn`` lookup and the project-tree scan.
        - config_edn_path: Path to a ``config.edn`` file whose ``:source-paths``
          entry should be parsed and injected. Skips the project-tree scan but

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Inspect `which clojure` and `clojure --help` to identify what binary is shadowing the real CLI
  2. Remove or rename the offending shim and install the official Clojure CLI from https://clojure.org/guides/getting_started
  3. Reorder PATH so the official CLI's bin directory takes precedence, then verify `clojure --help` mentions -Aaliases
  4. Upgrade the Clojure CLI if it is very old (older CLIs may lack the probed interface)

Example fix

// before
$ which clojure
/home/user/bin/clojure  # a shim
// after
rm /home/user/bin/clojure
export PATH=/usr/local/bin:$PATH  # official CLI first
clojure --help  # shows -Aaliases
Defensive patterns

Strategy: validation

Validate before calling

import shutil, subprocess
if shutil.which("clojure"):
    out = subprocess.run(["clojure", "--help"], capture_output=True, text=True).stdout
    if "-Aaliases" not in out:
        print("'clojure' on PATH is not the official CLI; remove the shim and install the official Clojure CLI")

Try / catch

try:
    server = ClojureLSP(...)
except RuntimeError as e:
    if "does not support '-Aaliases'" in str(e):
        raise SystemExit("Replace the non-standard 'clojure' binary on PATH with the official Clojure CLI")
    raise

Prevention

When it happens

Trigger: Calling verify_clojure_cli when shutil.which('clojure') finds a binary, but the output of `clojure --help` lacks the '-Aaliases' string — i.e. the binary does not behave like the official Clojure CLI.

Common situations: A shim/wrapper named `clojure` that forwards elsewhere (e.g. a Babashka or clj-style wrapper); very old Clojure CLI predating the expected interface; a stub script on PATH shadowing the real CLI; conda/nix environment providing a different clojure binary.

Related errors


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