oraios/serena · error · RuntimeError

Regal language server not found. Please install it from http

Error message

Regal language server not found. Please install it from https://github.com/StyraInc/regal or via your package manager.

What it means

The Regal (OPA Rego) language server wrapper resolves the `regal` CLI with `shutil.which` in `__init__`. Because Regal must be installed system-wide (the wrapper does not download it), a None result means the tool is unavailable and this RuntimeError is raised instead of attempting to start the server.

Source

Thrown at src/solidlsp/language_servers/regal_server.py:41

    @override
    def is_ignored_dirname(self, dirname: str) -> bool:
        return super().is_ignored_dirname(dirname) or dirname in [".regal", ".opa"]

    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
        """
        Creates a RegalLanguageServer instance.

        This class is not meant to be instantiated directly. Use LanguageServer.create() instead.

        :param config: Language server configuration
        :param repository_root_path: Path to the repository root
        :param solidlsp_settings: Settings for solidlsp
        """
        # Regal should be installed system-wide (via CI or user installation)
        regal_executable_path = shutil.which("regal")
        if not regal_executable_path:
            raise RuntimeError(
                "Regal language server not found. Please install it from https://github.com/StyraInc/regal or via your package manager."
            )

        super().__init__(
            config,
            repository_root_path,
            ProcessLaunchInfo(cmd=f"{regal_executable_path} language-server", cwd=repository_root_path),
            "rego",
            solidlsp_settings,
        )

    def _create_base_initialize_params(self) -> dict:
        """
        Returns the initialize params for the Regal Language Server.

        :return: LSP initialization parameters
        """
        initialize_params = {

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install Regal: `brew install regal`, `npm install -g @styrainc/regal`, or download a release binary from https://github.com/StyraInc/regal
  2. If already installed, ensure its directory (e.g. ~/go/bin, npm global bin) is on PATH for the process launching the library
  3. Verify with `which regal && regal --version` before instantiating

Example fix

# before
$ which regal  # not found

# after
$ npm install -g @styrainc/regal
$ which regal  # /usr/local/bin/regal
Defensive patterns

Strategy: validation

Validate before calling

import shutil
if shutil.which("regal") is None:
    raise SystemExit("Regal not found; install from https://github.com/StyraInc/regal (brew install regal or npm i -g @styrainc/regal)")

Type guard

def regal_available() -> bool:
    return shutil.which("regal") is not None

Try / catch

try:
    server = RegalServer(config, repo_root, settings)
except RuntimeError as e:
    if "Regal language server not found" in str(e):
        logger.error("Install regal and ensure it is on PATH: %s", e)
        raise SystemExit(1) from e
    raise

Prevention

When it happens

Trigger: Constructing the Regal server when `regal` is not on PATH: Regal never installed, installed via a version manager whose bin dir isn't in the daemon's PATH, or the binary is named/placed somewhere `shutil.which` can't see.

Common situations: New dev machine or CI container missing Regal; installed via `go install` into ~/go/bin which isn't on PATH; npm/brew install in an environment (cron, Docker, systemd service) with a minimal PATH.

Related errors


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