{"record":{"id":"7a39bc65876d4ce7","repo":"oraios/serena","slug":"failed-to-locate-or-download-al-language-server-p","errorCode":null,"errorMessage":"Failed to locate or download AL Language Server. Please either:\n1. Set AL_EXTENSION_PATH environment variable to the AL extension directory\n2. Install the AL extension in VS Code (ms-dynamics-smb.al)\n3. Ensure internet connection for automatic download","messagePattern":"Failed to locate or download AL Language Server\\. Please either:\n1\\. Set AL_EXTENSION_PATH environment variable to the AL extension directory\n2\\. Install the AL extension in VS Code \\(ms-dynamics-smb\\.al\\)\n3\\. Ensure internet connection for automatic download","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/al_language_server.py","lineNumber":204,"sourceCode":"        2. Downloads from VS Code marketplace if not found\n        3. Configures executable permissions on Unix systems\n        4. Returns the properly formatted command string\n\n        The AL Language Server executable is located in different paths based on the platform:\n        - Windows: bin/win32/Microsoft.Dynamics.Nav.EditorServices.Host.exe\n        - Linux: bin/linux/Microsoft.Dynamics.Nav.EditorServices.Host\n        - macOS: bin/darwin/Microsoft.Dynamics.Nav.EditorServices.Host\n        \"\"\"\n        system = platform.system()\n\n        # Find existing extension or download if needed\n        extension_path = cls._find_al_extension(solidlsp_settings)\n        if extension_path is None:\n            log.info(\"AL extension not found on disk, attempting to download...\")\n            extension_path = cls._download_and_install_al_extension(solidlsp_settings)\n\n        if extension_path is None:\n            raise RuntimeError(\n                \"Failed to locate or download AL Language Server. Please either:\\n\"\n                \"1. Set AL_EXTENSION_PATH environment variable to the AL extension directory\\n\"\n                \"2. Install the AL extension in VS Code (ms-dynamics-smb.al)\\n\"\n                \"3. Ensure internet connection for automatic download\"\n            )\n\n        # Build executable path based on platform\n        executable_path = cls._get_executable_path(extension_path, system)\n\n        if not os.path.exists(executable_path):\n            raise RuntimeError(f\"AL Language Server executable not found at: {executable_path}\")\n\n        # Prepare and return the executable command\n        return cls._prepare_executable(executable_path, system)\n\n    @classmethod\n    def _find_al_extension(cls, solidlsp_settings: SolidLSPSettings) -> str | None:\n        \"\"\"","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/al_language_server.py#L186-L222","documentation":"The AL language server is not distributed as a normal dependency; it is sourced from the VS Code AL extension (ms-dynamics-smb.al), found either via AL_EXTENSION_PATH, an installed VS Code extension, or downloaded. RuntimeError is raised when none of these three sources yields an extension directory.","triggerScenarios":"Constructing the AL language server (__init__ -> _setup_runtime_dependencies) when _find_al_extension returns None and _download_and_install_al_extension also returns None (no network, blocked marketplace, or no AL_EXTENSION_PATH set).","commonSituations":"Air-gapped/CI machines that cannot reach the VS Code marketplace; AL extension installed in a non-standard VS Code variant (VSCodium, Remote SSH) whose extensions dir isn't scanned; AL_EXTENSION_PATH pointing nowhere so it's ignored.","solutions":["Set the AL_EXTENSION_PATH environment variable to the directory of the installed ms-dynamics-smb.al extension.","Install the AL extension in VS Code (`code --install-extension ms-dynamics-smb.al`) so it can be found on disk.","Restore internet access to the VS Code marketplace and retry to allow automatic download."],"exampleFix":"// before\nexport AL_EXTENSION_PATH=\"\"\n// after (macOS)\nexport AL_EXTENSION_PATH=\"$HOME/.vscode/extensions/ms-dynamics-smb.al-*\"","handlingStrategy":"fallback","validationCode":"import os, glob\n\ndef al_extension_available() -> bool:\n    if os.environ.get('AL_EXTENSION_PATH') and os.path.isdir(os.environ['AL_EXTENSION_PATH']):\n        return True\n    for pat in ('~/.vscode/extensions/ms-dynamics-smb.al-*',\n                '~/.vscode-server/extensions/ms-dynamics-smb.al-*',\n                '~/.vscode-insiders/extensions/ms-dynamics-smb.al-*'):\n        if glob.glob(os.path.expanduser(pat)):\n            return True\n    return False","typeGuard":"def has_al_extension_path(env: dict[str, str]) -> bool:\n    p = env.get('AL_EXTENSION_PATH')\n    return isinstance(p, str) and os.path.isdir(p)","tryCatchPattern":"try:\n    server = ALLanguageServer(...)\nexcept RuntimeError as e:\n    if 'Failed to locate or download AL Language Server' in str(e):\n        subprocess.run(['code', '--install-extension', 'ms-dynamics-smb.al'], check=True)\n        server = ALLanguageServer(...)\n    else:\n        raise","preventionTips":["Set AL_EXTENSION_PATH explicitly in CI/air-gapped environments pointing at a pre-seeded extension copy.","Install the AL extension via `code --install-extension ms-dynamics-smb.al` in setup scripts.","Allowlist marketplace (marketplace.visualstudio.com) egress if relying on automatic download."],"tags":["language-server","environment","download","vscode-extension"],"backgroundTag":"missing-language-server-dependency","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}