Crash when client advertises `workspace/workspaceFolders` but doesn’t implement handler
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- devtools
Línea de trabajo
Comienza en src/server.ts y sigue el manejo de workspace-folder a través de src/lifecycle/MatlabSession.ts, src/lifecycle/PathSynchronizer.ts y src/indexing/WorkspaceIndexer.ts. Verifica la ruta de error indicada con el escenario de cliente proporcionado y las comprobaciones existentes del repositorio. La tarea está terminada cuando las solicitudes de workspace-folder fallidas o null ya no hacen que el servidor se bloquee, se utilizan las carpetas de inicialización cuando están disponibles y la indexación posterior continúa con un fallback vacío.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When a client advertises workspace.workspaceFolders but does not implement the workspace/workspaceFolders request, the server assumes success and later code dereferences a missing/failed result, causing a crash.
To Reproduce
- Start the server with a client that sets
capabilities.workspace.workspaceFolders = truebut does not handleworkspace/workspaceFolders(e.g., powernap/crush). - Complete initialize/initialized.
- The server requests
workspace/workspaceFolders; the client returns a JSON-RPC error; the server crashes or becomes unstable.
Expected behavior
- No crash. Treat request errors/null as no folders and continue.
- Prefer
InitializeParams.workspaceFolderswhen present and cache for later use.
Useful Information
- MATLAB-language-server Version: v1.3.6
- MATLAB Version: R2025b Update 1 (25.2.0.3042426) 64-bit (glnxa64)
- OS Version: Ubuntu 24.04.3 LTS as devcontainer (mcr.microsoft.com/devcontainers/base:ubuntu-24.04) with MATLAB feature (ghcr.io/mathworks/devcontainer-features/matlab)
- Language Server Client: crush v0.13.6
Additional context
- Affected code: src/server.ts (capability gate), src/lifecycle/MatlabSession.ts (launch dir), src/lifecycle/PathSynchronizer.ts (on connect), src/indexing/WorkspaceIndexer.ts (index roots).
- Repro: node build from source; ran
/opt/matlab-language-server/out/index.jswith the client above (crush). - Fix: defensively wrap all
getWorkspaceFolders()calls; only enable PathSynchronizer if the request succeeds; fall back toInitializeParams.workspaceFoldersor[]and log a warning when clients error.
I will be submitting a pull request.
Example traffic between `crush` and `matlab-langauge-server`
Example traffic between crush and matlab-langauge-server
stdin:
Content-Length: 2837
{"id":0,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"marked","version":"1.1.0"},"positionEncodings":["utf-16"],"regularExpressions":{"engine":"ECMAScript","version":"ES2020"}},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"dynamicRegistration":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"completion":{"completionItem":{"commitCharactersSupport":true,"deprecatedSupport":true,"documentationFormat":["markdown","plaintext"],"insertReplaceSupport":true,"preselectSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":false,"tagSupport":{"valueSet":[1]}},"contextSupport":true,"dynamicRegistration":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":true},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":true},"publishDiagnostics":{"codeDescriptionSupport":true,"dataSupport":true,"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":true},"rangeFormatting":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"synchronization":{"didSave":true,"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"fileOperations":{"didCreate":true,"didDelete":true,"didRename":true,"dynamicRegistration":true,"willCreate":true,"willDelete":true,"willRename":true},"symbol":{"dynamicRegistration":true},"workspaceEdit":{"documentChanges":true,"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"powernap","version":"0.1.0"},"initializationOptions":{"MATLAB":{"indexWorkspace":true,"installPath":"/opt/matlab/R2025b","matlabConnectionTiming":"onStart","prewarmGraphics":false,"signIn":true,"telemetry":false}},"locale":"en-us","processId":26471,"rootPath":"/workspaces/agentic-matlab-example","rootUri":"file:///workspaces/agentic-matlab-example","trace":"off","workspaceFolders":[{"uri":"file:///workspaces/agentic-matlab-example","name":"agentic-matlab-example"}]}}Content-Length: 52
{"jsonrpc":"2.0","method":"initialized","params":{}}Content-Length: 38
{"id":0,"result":null,"jsonrpc":"2.0"}Content-Length: 38
{"id":1,"result":[{}],"jsonrpc":"2.0"}Content-Length: 38
{"id":2,"result":null,"jsonrpc":"2.0"}Content-Length: 105
{"id":3,"error":{"code":0,"message":"no handler for method: workspace/workspaceFolders"},"jsonrpc":"2.0"}
stdout:
Content-Length: 134
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"(17:12:36) matlabls: Log Directory: /tmp/matlabls_26511"}}Content-Length: 583
{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"codeActionProvider":true,"completionProvider":{"triggerCharacters":[".","("," ",",","/","\\"]},"definitionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"executeCommandProvider":{"commands":["matlabls.lint.suppress.line","matlabls.lint.suppress.file"]},"foldingRangeProvider":true,"referencesProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"documentSymbolProvider":true,"renameProvider":{"prepareProvider":true},"documentHighlightProvider":true,"textDocumentSync":2}}}Content-Length: 201
{"jsonrpc":"2.0","id":0,"method":"client/registerCapability","params":{"registrations":[{"id":"91b68732-e3ec-49a1-bfb6-1202b45aad6f","method":"workspace/didChangeConfiguration","registerOptions":{}}]}}Content-Length: 101
{"jsonrpc":"2.0","id":1,"method":"workspace/configuration","params":{"items":[{"section":"MATLAB"}]}}Content-Length: 204
{"jsonrpc":"2.0","id":2,"method":"client/registerCapability","params":{"registrations":[{"id":"93246463-a499-485b-b7af-5c7110954b4d","method":"workspace/didChangeWorkspaceFolders","registerOptions":{}}]}}Content-Length: 103
{"jsonrpc":"2.0","method":"matlab/connection/update/server","params":{"connectionStatus":"connecting"}}Content-Length: 62
{"jsonrpc":"2.0","id":3,"method":"workspace/workspaceFolders"}
stderr:
(node:26511) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/opt/matlab-language-server/out/index.js:43412
responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
^
ResponseError: no handler for method: workspace/workspaceFolders
at handleResponse (/opt/matlab-language-server/out/index.js:43412:48)
at handleMessage (/opt/matlab-language-server/out/index.js:43192:13)
at processMessageQueue (/opt/matlab-language-server/out/index.js:43209:17)
at Immediate.<anonymous> (/opt/matlab-language-server/out/index.js:43181:13)
at process.processImmediate (node:internal/timers:485:21) {
code: 0,
data: undefined
}
Node.js v22.21.1
Example `crush.json` lsp config for `matlab-language-server`
Example crush.json lsp config for matlab-language-server
{
"$schema": "https://charm.land/crush.json",
"lsp": {
"matlab": {
"command": "/usr/local/bin/matlab-language-server",
"args": [
"--stdio"
],
"env": {
"MLM_LICENSE_FILE": "27000@host"
},
"init_options": {
"MATLAB": {
"installPath": "/opt/matlab/R2025b",
"indexWorkspace": true,
"matlabConnectionTiming": "onStart",
"telemetry": false,
"signIn": true,
"prewarmGraphics": false
}
}
}
},
...
}
- Lenguaje dominante
- TypeScript
- Estrellas
- 125
- Forks
- 21
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de mathworks/MATLAB-language-server
-
install/run instructions? Abiertodocumentation enhancement
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
mathworks/MATLAB-language-server#27 · 10 comentarios ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
mathworks/MATLAB-language-server#82 · 1 reacción ·
-
Add progress handler Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
mathworks/MATLAB-language-server#81 · 4 comentarios ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
mathworks/MATLAB-language-server#79 · 7 comentarios ·
-
`--matlabLaunchCommandArgs` does not accept value starting with "-" (Not enough arguments following) Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
mathworks/MATLAB-language-server#78 · 8 comentarios ·
Todos los issues de mathworks/MATLAB-language-server
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Abiertobug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Client support matrix inclusion Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
calcite-components needs triage refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Esri/calcite-design-system#15203 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
danielmiessler/LifeOS#2218 ·