{"record":{"id":"bd8a470ad8171e81","repo":"oraios/serena","slug":"regal-language-server-not-found-please-install-it","errorCode":null,"errorMessage":"Regal language server not found. Please install it from https://github.com/StyraInc/regal or via your package manager.","messagePattern":"Regal language server not found\\. Please install it from https://github\\.com/StyraInc/regal or via your package manager\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/regal_server.py","lineNumber":41,"sourceCode":"\n    @override\n    def is_ignored_dirname(self, dirname: str) -> bool:\n        return super().is_ignored_dirname(dirname) or dirname in [\".regal\", \".opa\"]\n\n    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):\n        \"\"\"\n        Creates a RegalLanguageServer instance.\n\n        This class is not meant to be instantiated directly. Use LanguageServer.create() instead.\n\n        :param config: Language server configuration\n        :param repository_root_path: Path to the repository root\n        :param solidlsp_settings: Settings for solidlsp\n        \"\"\"\n        # Regal should be installed system-wide (via CI or user installation)\n        regal_executable_path = shutil.which(\"regal\")\n        if not regal_executable_path:\n            raise RuntimeError(\n                \"Regal language server not found. Please install it from https://github.com/StyraInc/regal or via your package manager.\"\n            )\n\n        super().__init__(\n            config,\n            repository_root_path,\n            ProcessLaunchInfo(cmd=f\"{regal_executable_path} language-server\", cwd=repository_root_path),\n            \"rego\",\n            solidlsp_settings,\n        )\n\n    def _create_base_initialize_params(self) -> dict:\n        \"\"\"\n        Returns the initialize params for the Regal Language Server.\n\n        :return: LSP initialization parameters\n        \"\"\"\n        initialize_params = {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/regal_server.py#L23-L59","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install Regal: `brew install regal`, `npm install -g @styrainc/regal`, or download a release binary from https://github.com/StyraInc/regal","If already installed, ensure its directory (e.g. ~/go/bin, npm global bin) is on PATH for the process launching the library","Verify with `which regal && regal --version` before instantiating"],"exampleFix":"# before\n$ which regal  # not found\n\n# after\n$ npm install -g @styrainc/regal\n$ which regal  # /usr/local/bin/regal","handlingStrategy":"validation","validationCode":"import shutil\nif shutil.which(\"regal\") is None:\n    raise SystemExit(\"Regal not found; install from https://github.com/StyraInc/regal (brew install regal or npm i -g @styrainc/regal)\")","typeGuard":"def regal_available() -> bool:\n    return shutil.which(\"regal\") is not None","tryCatchPattern":"try:\n    server = RegalServer(config, repo_root, settings)\nexcept RuntimeError as e:\n    if \"Regal language server not found\" in str(e):\n        logger.error(\"Install regal and ensure it is on PATH: %s\", e)\n        raise SystemExit(1) from e\n    raise","preventionTips":["Install regal in the dev container/CI image as part of tooling bootstrap","Add version-manager bin dirs (~/go/bin, npm global bin) to PATH for headless processes","Run `regal --version` in preflight checks before enabling Rego language features"],"tags":["rego","opa","missing-binary","path"],"backgroundTag":"command-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}