{"record":{"id":"711c5b0c4d310dc5","repo":"oraios/serena","slug":"matlab-language-server-script-not-found-at-serve","errorCode":null,"errorMessage":"MATLAB Language Server script not found at: {server_script}","messagePattern":"MATLAB Language Server script not found at: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/matlab_language_server.py","lineNumber":352,"sourceCode":"            # 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]:\n            return {\n                \"MATLAB_INSTALL_PATH\": self.get_matlab_path(),\n            }\n\n    def _create_base_initialize_params(self) -> dict:\n        \"\"\"Return the initialize params for the MATLAB Language Server.\"\"\"\n        initialize_params = {\n            \"locale\": \"en\",\n            \"capabilities\": {\n                \"textDocument\": {\n                    \"synchronization\": {\"didSave\": True, \"dynamicRegistration\": True},","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/matlab_language_server.py#L334-L370","documentation":"As a final sanity check before building the `[node, server_script, --stdio]` command, create_launch_command verifies the script returned by _get_executable_path actually exists on disk. If not, RuntimeError is raised — usually a race or path inconsistency between extension resolution and script lookup.","triggerScenarios":"_get_executable_path returns a path (e.g. inside the downloaded extension) that is subsequently missing — the extension directory changed/deleted between resolution and check, _get_executable_path returned a computed default path without verifying it, or a partially extracted/corrupted extension download.","commonSituations":"Interrupted or partial extension download; antivirus/cleanup tooling removing files from the extension dir; custom MATLAB_EXTENSION_PATH whose expected script name differs from what the code builds.","solutions":["Reinstall/re-download the MATLAB extension so the full script layout exists","Point MATLAB_EXTENSION_PATH at a verified, complete extension directory containing the server script","List the extension directory to confirm the exact script path the integration computes exists"],"exampleFix":"# before\nexport MATLAB_EXTENSION_PATH=/tmp/partial-extract   # script missing\n# after\nexport MATLAB_EXTENSION_PATH=~/.vscode/extensions/MathWorks.language-matlab-1.4.0","handlingStrategy":"validation","validationCode":"import os\nserver_script = os.path.join(os.environ[\"MATLAB_EXTENSION_PATH\"], \"dist\", \"index.js\")\nassert os.path.exists(server_script), f\"missing server script: {server_script}\"","typeGuard":"def script_exists(path: str) -> bool:\n    return os.path.isfile(path)","tryCatchPattern":"try:\n    ls = SolidLSP(\"matlab\")\nexcept RuntimeError as e:\n    if \"script not found at\" in str(e):\n        redownload_matlab_extension(); ls = SolidLSP(\"matlab\")\n    else:\n        raise","preventionTips":["Re-download the extension if extraction may have been interrupted","Exclude extension directories from antivirus/cleanup jobs","Verify the resolved script path exists immediately before launching"],"tags":["matlab","path","filesystem","nodejs"],"backgroundTag":"server-script-not-found","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}