{"record":{"id":"05bb0e00999b61ed","repo":"oraios/serena","slug":"matlab-installation-directory-does-not-exist-mat","errorCode":null,"errorMessage":"MATLAB installation directory does not exist: {matlab_path}","messagePattern":"MATLAB installation directory does not exist: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/matlab_language_server.py","lineNumber":321,"sourceCode":"            raise RuntimeError(\n                f\"MATLAB installation not found. Set the {MATLAB_PATH_ENV_VAR} environment variable \"\n                \"to your MATLAB installation directory (e.g., /Applications/MATLAB_R2024b.app on macOS, \"\n                \"C:\\\\Program Files\\\\MATLAB\\\\R2024b on Windows, or /usr/local/MATLAB/R2024b on Linux).\"\n            )\n\n        def get_matlab_path(self) -> str:\n            \"\"\"Get MATLAB path from settings or auto-detect.\"\"\"\n            if self._matlab_path is not None:\n                return self._matlab_path\n\n            matlab_path = self._custom_settings.get(\"matlab_path\")\n\n            if not matlab_path:\n                matlab_path = self._find_matlab_installation()  # Raises RuntimeError if not found\n\n            # Verify MATLAB path exists\n            if not os.path.isdir(matlab_path):\n                raise RuntimeError(f\"MATLAB installation directory does not exist: {matlab_path}\")\n\n            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","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/matlab_language_server.py#L303-L339","documentation":"get_matlab_path validates that the resolved MATLAB directory actually exists on disk. If MATLAB_PATH (or a caller-supplied path) points to a non-existent directory, RuntimeError is raised rather than silently launching the server against a bogus root.","triggerScenarios":"Setting MATLAB_PATH (or passing matlab_path to get_matlab_path) to a path that is not a directory — a typo, a stale path after uninstalling/upgrading MATLAB (e.g. R2024b removed, now R2025a), or a path with wrong casing/drive letter on Windows.","commonSituations":"Upgrading MATLAB versions leaves an old env var pointing at the deleted install; container image rebakes with a different MATLAB path; trailing mistakes like pointing at a file instead of a directory.","solutions":["Correct the MATLAB_PATH environment variable to an existing MATLAB directory (ls the path to verify)","Update the path after a MATLAB version upgrade to the new install directory","Verify with a directory check before starting the server: os.path.isdir(os.environ[\"MATLAB_PATH\"])"],"exampleFix":"# before\nexport MATLAB_PATH=/usr/local/MATLAB/R2023a   # uninstalled\n# after\nexport MATLAB_PATH=/usr/local/MATLAB/R2024b","handlingStrategy":"validation","validationCode":"import os\nmatlab_path = os.environ.get(\"MATLAB_PATH\", \"\")\nif matlab_path and not os.path.isdir(matlab_path):\n    raise RuntimeError(f\"MATLAB_PATH points to a missing directory: {matlab_path}\")","typeGuard":"def is_dir_path(p: str) -> bool:\n    return bool(p) and os.path.isdir(p)","tryCatchPattern":"try:\n    ls = SolidLSP(\"matlab\")\nexcept RuntimeError as e:\n    if \"does not exist\" in str(e) and \"MATLAB\" in str(e):\n        fix_matlab_path_to_existing_install(); ls = SolidLSP(\"matlab\")\n    else:\n        raise","preventionTips":["Update MATLAB_PATH whenever the MATLAB version changes","Point to the install directory (not a file or symlink target that may vanish)","Validate env-provided paths at config load time"],"tags":["matlab","path","environment","validation"],"backgroundTag":"invalid-path-configuration","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}