oraios/serena · error · RuntimeError

MATLAB language server script not found in extension at {ext

Error message

MATLAB language server script not found in extension at {extension_path}

What it means

After locating (or downloading) the VS Code MATLAB extension, the server looks for its language server entry script (first at the standard location, then out/index.js). If neither exists inside the extension directory, _get_executable_path raises RuntimeError, meaning the extension is present but its layout is not what this integration expects.

Source

Thrown at src/solidlsp/language_servers/matlab_language_server.py:236

        def _get_executable_path(cls, extension_path: str) -> str:
            """
            Get the path to the MATLAB language server executable based on platform.

            The language server is a Node.js script located in the extension's server directory.
            """
            # The MATLAB extension bundles the language server in the 'server' directory
            server_dir = os.path.join(extension_path, "server", "out")
            main_script = os.path.join(server_dir, "index.js")

            if os.path.exists(main_script):
                return main_script

            # Alternative location
            alt_script = os.path.join(extension_path, "out", "index.js")
            if os.path.exists(alt_script):
                return alt_script

            raise RuntimeError(f"MATLAB language server script not found in extension at {extension_path}")

        @staticmethod
        def _find_matlab_installation() -> str:
            """
            Find MATLAB installation path.

            Search order:
                1. MATLAB_PATH environment variable
                2. Common installation locations based on platform

            Returns:
                Path to MATLAB installation directory.

            Raises:
                RuntimeError: If MATLAB installation is not found.

            """
            # Check environment variable first

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Set MATLAB_EXTENSION_PATH to the exact extension directory containing the server script (check for dist/index.js or out/index.js inside it)
  2. Re-download/reinstall the MathWorks.language-matlab extension so a complete copy is on disk
  3. Inspect the extension folder contents and confirm the script path the code expects; if the layout changed, pin/use a compatible extension version

Example fix

# before
export MATLAB_EXTENSION_PATH=~/.vscode/extensions   # wrong: parent dir
# after
export MATLAB_EXTENSION_PATH=~/.vscode/extensions/MathWorks.language-matlab-<version>
Defensive patterns

Strategy: validation

Validate before calling

import os
ext = os.environ.get("MATLAB_EXTENSION_PATH", "")
assert ext and (os.path.exists(os.path.join(ext, "out", "index.js")) or
                any(os.path.exists(os.path.join(ext, s)) for s in ("dist/index.js", "extension/dist/index.js"))), \
    "extension dir lacks the expected server script"

Type guard

def has_server_script(ext_dir: str) -> bool:
    return os.path.isdir(ext_dir) and (
        os.path.exists(os.path.join(ext_dir, "out", "index.js")) or
        os.path.exists(os.path.join(ext_dir, "dist", "index.js")))

Try / catch

try:
    ls = SolidLSP("matlab")
except RuntimeError as e:
    if "language server script not found" in str(e):
        reinstall_matlab_extension(); ls = SolidLSP("matlab")
    else:
        raise

Prevention

When it happens

Trigger: create_launch_command resolves an extension_path whose directory does not contain the expected server script layout (missing extension/dist or out/index.js) — e.g. MATLAB_EXTENSION_PATH points to the wrong folder, or the downloaded extension's internal layout changed between versions.

Common situations: Pointing MATLAB_EXTENSION_PATH at the .vsix file or the VS Code extensions root instead of the specific extension directory; MathWorks renaming internal paths in a newer extension version; a truncated/corrupted download.

Related errors


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