oraios/serena · error · RuntimeError
Failed to locate or download MATLAB Language Server. Please
Error message
Failed to locate or download MATLAB Language Server. Please either: 1. Set MATLAB_EXTENSION_PATH environment variable to the MATLAB extension directory 2. Install the MATLAB extension in VS Code (MathWorks.language-matlab) 3. Ensure internet connection for automatic download
What it means
After checking disk locations and attempting an automatic download, create_launch_command gives up if no MATLAB extension directory could be obtained. The error enumerates the three supported ways to supply the extension: env var, VS Code install, or network download.
Source
Thrown at src/solidlsp/language_servers/matlab_language_server.py:341
log.info(f"Using MATLAB installation: {matlab_path}")
self._matlab_path = matlab_path
return matlab_path
def create_launch_command(self) -> list[str]:
# Verify node is installed
node_path = shutil.which("node")
if node_path is None:
raise RuntimeError("Node.js is not installed or isn't in PATH. Please install Node.js and try again.")
# Find existing extension or download if needed
extension_path = self._find_matlab_extension()
if extension_path is None:
log.info("MATLAB extension not found on disk, attempting to download...")
extension_path = self._download_and_install_matlab_extension()
if extension_path is None:
raise RuntimeError(
"Failed to locate or download MATLAB Language Server. Please either:\n"
"1. Set MATLAB_EXTENSION_PATH environment variable to the MATLAB extension directory\n"
"2. Install the MATLAB extension in VS Code (MathWorks.language-matlab)\n"
"3. Ensure internet connection for automatic download"
)
# Get the language server script path
server_script = self._get_executable_path(extension_path)
if not os.path.exists(server_script):
raise RuntimeError(f"MATLAB Language Server script not found at: {server_script}")
# Build the command to run the language server
# The MATLAB language server is run via Node.js with the --stdio flag
cmd = [node_path, server_script, "--stdio"]
return cmd
def create_launch_command_env(self) -> dict[str, str]:View on GitHub (pinned to 7fcbca7e62)
Solutions
- Set MATLAB_EXTENSION_PATH to the directory of the MathWorks.language-matlab extension
- Install the MATLAB extension in VS Code so it exists on disk under ~/.vscode/extensions
- Restore network access to the extension download host and retry the automatic download
Example fix
# before # nothing set, no extension installed # after export MATLAB_EXTENSION_PATH=~/.vscode/extensions/MathWorks.language-matlab-1.4.0
Defensive patterns
Strategy: fallback
Validate before calling
import os
def ensure_matlab_extension():
ext = os.environ.get("MATLAB_EXTENSION_PATH")
if ext and os.path.isdir(ext):
return ext
vscode_ext = os.path.expanduser("~/.vscode/extensions")
if os.path.isdir(vscode_ext):
for d in os.listdir(vscode_ext):
if d.startswith("MathWorks.language-matlab"):
return os.path.join(vscode_ext, d)
raise RuntimeError("Install MathWorks.language-matlab or set MATLAB_EXTENSION_PATH") Type guard
def extension_located() -> bool:
ext = os.environ.get("MATLAB_EXTENSION_PATH")
return bool(ext) and os.path.isdir(ext) Try / catch
try:
ls = SolidLSP("matlab")
except RuntimeError as e:
if "Failed to locate or download MATLAB Language Server" in str(e):
install_vscode_matlab_extension() # fallback path
ls = SolidLSP("matlab")
else:
raise Prevention
- Set MATLAB_EXTENSION_PATH explicitly in offline/proxied environments
- Pre-install the VS Code extension in golden images
- Ensure network access to the extension download host for auto-install
When it happens
Trigger: create_launch_command finds no extension via _find_matlab_extension (MATLAB_EXTENSION_PATH unset/invalid and no MathWorks.language-matlab in VS Code extensions dirs) and _download_and_install_matlab_extension also returns None (download failed or network blocked).
Common situations: Offline/air-gapped machines; GitHub/marketplace downloads blocked by firewall; MATLAB_EXTENSION_PATH typo'd; VS Code not installed so no extensions directory exists; corrupted download leaving no usable directory.
Related errors
- Download failed? Could not find marksman executable at {mark
- Nextflow Language Server JAR not found at {jar_path}
- Failed to install .NET {version} runtime using install scrip
- Download failed? Could not find ada_language_server executab
- BSL Language Server JAR not found at {jar_path} after instal
AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29).
Data as JSON: /api/errors/868f65fe311737de.
Report an issue: GitHub.