oraios/serena · error

Failed to locate or download AL Language Server. Please eith

Error message

Failed to locate or download AL Language Server. Please either:
1. Set AL_EXTENSION_PATH environment variable to the AL extension directory
2. Install the AL extension in VS Code (ms-dynamics-smb.al)
3. Ensure internet connection for automatic download

What it means

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.

Source

Thrown at src/solidlsp/language_servers/al_language_server.py:204

        2. Downloads from VS Code marketplace if not found
        3. Configures executable permissions on Unix systems
        4. Returns the properly formatted command string

        The AL Language Server executable is located in different paths based on the platform:
        - Windows: bin/win32/Microsoft.Dynamics.Nav.EditorServices.Host.exe
        - Linux: bin/linux/Microsoft.Dynamics.Nav.EditorServices.Host
        - macOS: bin/darwin/Microsoft.Dynamics.Nav.EditorServices.Host
        """
        system = platform.system()

        # Find existing extension or download if needed
        extension_path = cls._find_al_extension(solidlsp_settings)
        if extension_path is None:
            log.info("AL extension not found on disk, attempting to download...")
            extension_path = cls._download_and_install_al_extension(solidlsp_settings)

        if extension_path is None:
            raise RuntimeError(
                "Failed to locate or download AL Language Server. Please either:\n"
                "1. Set AL_EXTENSION_PATH environment variable to the AL extension directory\n"
                "2. Install the AL extension in VS Code (ms-dynamics-smb.al)\n"
                "3. Ensure internet connection for automatic download"
            )

        # Build executable path based on platform
        executable_path = cls._get_executable_path(extension_path, system)

        if not os.path.exists(executable_path):
            raise RuntimeError(f"AL Language Server executable not found at: {executable_path}")

        # Prepare and return the executable command
        return cls._prepare_executable(executable_path, system)

    @classmethod
    def _find_al_extension(cls, solidlsp_settings: SolidLSPSettings) -> str | None:
        """

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Set the AL_EXTENSION_PATH environment variable to the directory of the installed ms-dynamics-smb.al extension.
  2. Install the AL extension in VS Code (`code --install-extension ms-dynamics-smb.al`) so it can be found on disk.
  3. Restore internet access to the VS Code marketplace and retry to allow automatic download.

Example fix

// before
export AL_EXTENSION_PATH=""
// after (macOS)
export AL_EXTENSION_PATH="$HOME/.vscode/extensions/ms-dynamics-smb.al-*"
Defensive patterns

Strategy: fallback

Validate before calling

import os, glob

def al_extension_available() -> bool:
    if os.environ.get('AL_EXTENSION_PATH') and os.path.isdir(os.environ['AL_EXTENSION_PATH']):
        return True
    for pat in ('~/.vscode/extensions/ms-dynamics-smb.al-*',
                '~/.vscode-server/extensions/ms-dynamics-smb.al-*',
                '~/.vscode-insiders/extensions/ms-dynamics-smb.al-*'):
        if glob.glob(os.path.expanduser(pat)):
            return True
    return False

Type guard

def has_al_extension_path(env: dict[str, str]) -> bool:
    p = env.get('AL_EXTENSION_PATH')
    return isinstance(p, str) and os.path.isdir(p)

Try / catch

try:
    server = ALLanguageServer(...)
except RuntimeError as e:
    if 'Failed to locate or download AL Language Server' in str(e):
        subprocess.run(['code', '--install-extension', 'ms-dynamics-smb.al'], check=True)
        server = ALLanguageServer(...)
    else:
        raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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