Skip to content

fix: post-shutdown requests return InvalidRequest (-32600) (#11)#14

Merged
meymchen merged 1 commit into
mainfrom
issue/11-shutdown-invalid-request
Jun 16, 2026
Merged

fix: post-shutdown requests return InvalidRequest (-32600) (#11)#14
meymchen merged 1 commit into
mainfrom
issue/11-shutdown-invalid-request

Conversation

@meymchen

Copy link
Copy Markdown
Owner

Summary

Closes #11.

LSP lifecycle requires that requests arriving after a shutdown request error with InvalidRequest. The dispatcher's request gate only checked the Uninitialized state, so a request sent between shutdown and exit fell through to the method match — initialize returned the right code for the wrong reason, and anything else returned MethodNotFound (-32601).

Change

  • Add a ShuttingDown branch to the request path that returns InvalidRequest (-32600) for any request, mirroring the existing Uninitialized -> ServerNotInitialized gate.
  • exit (a notification) stays on the notification path and is unaffected.
  • Add LspError::InvalidRequest (-32600) and the invalid_request constructor.

Test

  • request_after_shutdown_returns_invalid_request: drives initialize -> shutdown -> textDocument/hover and asserts the hover response is -32600, then confirms exit still terminates the dispatcher with code 0.

🤖 Generated with Claude Code

LSP lifecycle requires that requests arriving after `shutdown` error with
InvalidRequest. The request gate only checked `Uninitialized`, so a request
between `shutdown` and `exit` fell through to the method match (initialize ->
wrong reason, anything else -> MethodNotFound).

Add a `ShuttingDown` branch to the request path returning InvalidRequest
(-32600) for any request, mirroring the `Uninitialized` -> ServerNotInitialized
gate. `exit` stays on the notification path and is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@meymchen meymchen merged commit 823fd5d into main Jun 16, 2026
2 of 3 checks passed
@meymchen meymchen deleted the issue/11-shutdown-invalid-request branch June 16, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Post-shutdown requests should error with InvalidRequest (-32600)

1 participant