{"record":{"id":"868f65fe311737de","repo":"oraios/serena","slug":"failed-to-locate-or-download-matlab-language-serve","errorCode":null,"errorMessage":"Failed to locate or download MATLAB Language Server. Please either:\n1. Set MATLAB_EXTENSION_PATH environment variable to the MATLAB extension directory\n2. Install the MATLAB extension in VS Code (MathWorks.language-matlab)\n3. Ensure internet connection for automatic download","messagePattern":"Failed to locate or download MATLAB Language Server\\. Please either:\n1\\. Set MATLAB_EXTENSION_PATH environment variable to the MATLAB extension directory\n2\\. Install the MATLAB extension in VS Code \\(MathWorks\\.language-matlab\\)\n3\\. Ensure internet connection for automatic download","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/matlab_language_server.py","lineNumber":341,"sourceCode":"            log.info(f\"Using MATLAB installation: {matlab_path}\")\n\n            self._matlab_path = matlab_path\n            return matlab_path\n\n        def create_launch_command(self) -> list[str]:\n            # Verify node is installed\n            node_path = shutil.which(\"node\")\n            if node_path is None:\n                raise RuntimeError(\"Node.js is not installed or isn't in PATH. Please install Node.js and try again.\")\n\n            # Find existing extension or download if needed\n            extension_path = self._find_matlab_extension()\n            if extension_path is None:\n                log.info(\"MATLAB extension not found on disk, attempting to download...\")\n                extension_path = self._download_and_install_matlab_extension()\n\n            if extension_path is None:\n                raise RuntimeError(\n                    \"Failed to locate or download MATLAB Language Server. Please either:\\n\"\n                    \"1. Set MATLAB_EXTENSION_PATH environment variable to the MATLAB extension directory\\n\"\n                    \"2. Install the MATLAB extension in VS Code (MathWorks.language-matlab)\\n\"\n                    \"3. Ensure internet connection for automatic download\"\n                )\n\n            # Get the language server script path\n            server_script = self._get_executable_path(extension_path)\n\n            if not os.path.exists(server_script):\n                raise RuntimeError(f\"MATLAB Language Server script not found at: {server_script}\")\n\n            # Build the command to run the language server\n            # The MATLAB language server is run via Node.js with the --stdio flag\n            cmd = [node_path, server_script, \"--stdio\"]\n            return cmd\n\n        def create_launch_command_env(self) -> dict[str, str]:","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/matlab_language_server.py#L323-L359","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\n# nothing set, no extension installed\n# after\nexport MATLAB_EXTENSION_PATH=~/.vscode/extensions/MathWorks.language-matlab-1.4.0","handlingStrategy":"fallback","validationCode":"import os\ndef ensure_matlab_extension():\n    ext = os.environ.get(\"MATLAB_EXTENSION_PATH\")\n    if ext and os.path.isdir(ext):\n        return ext\n    vscode_ext = os.path.expanduser(\"~/.vscode/extensions\")\n    if os.path.isdir(vscode_ext):\n        for d in os.listdir(vscode_ext):\n            if d.startswith(\"MathWorks.language-matlab\"):\n                return os.path.join(vscode_ext, d)\n    raise RuntimeError(\"Install MathWorks.language-matlab or set MATLAB_EXTENSION_PATH\")","typeGuard":"def extension_located() -> bool:\n    ext = os.environ.get(\"MATLAB_EXTENSION_PATH\")\n    return bool(ext) and os.path.isdir(ext)","tryCatchPattern":"try:\n    ls = SolidLSP(\"matlab\")\nexcept RuntimeError as e:\n    if \"Failed to locate or download MATLAB Language Server\" in str(e):\n        install_vscode_matlab_extension()  # fallback path\n        ls = SolidLSP(\"matlab\")\n    else:\n        raise","preventionTips":["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"],"tags":["matlab","download","installation","network"],"backgroundTag":"dependency-install-failed","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}