Skip to content

Conversation

@G-hoon
Copy link

@G-hoon G-hoon commented Jan 18, 2026

Summary

Fix unhandled promise rejection in warmupClient() that causes process crash when LSP server fails to start.

Problem

warmupClient() uses a fire-and-forget pattern but had no error handling:

initPromise.then(() => {
  // success handling only
})
// ❌ No .catch() - unhandled rejection if start() or initialize() fails

When the LSP server binary is not found, has permission issues, or fails to initialize, the promise rejection goes unhandled, causing:

  • UnhandledPromiseRejection error
  • Process exit with code 1

Reproduction

lspManager.warmupClient("/tmp", {
  id: "fake-lsp",
  command: ["nonexistent-binary"],
  filetypes: ["fake"],
})
// Before: Exit code 1, UnhandledPromiseRejection
// After: Error logged, process continues normally

Solution

Add .catch() handler to:

  1. Log the error with context (server ID)
  2. Clean up the failed client from the map
  3. Stop the client to release resources

Changes

  • src/tools/lsp/client.ts: Add error handling to warmupClient() initialization promise

Summary by cubic

Handle LSP warmup initialization errors to prevent unhandled promise rejections and process crashes. warmupClient() now catches start/initialize failures, logs the error with server ID, removes the failed client, and stops it so the process keeps running.

Written for commit 161da10. Summary will update on new commits.

Previously, warmupClient() used fire-and-forget pattern without
error handling. If LSP server failed to start (binary not found,
permission denied, etc.), the promise rejection was unhandled,
causing process crash with exit code 1.

Now errors are caught and logged, and the failed client is cleaned
up from the client map.

Reproduction:
- Call warmupClient() with a non-existent binary
- Before: UnhandledPromiseRejection, exit code 1
- After: Error logged, process continues normally
@G-hoon
Copy link
Author

G-hoon commented Jan 18, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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.

1 participant