Files
kilocode/packages/kilo-vscode/docs/error-handling/cli-startup-errors.md
T
Mark IJbema a4c4cf5f52 docs(vscode): expand project board issues into detailed doc files
Replace the flat issue list in the migration plan with 37 detailed doc
files, one per issue, grouped into ui-polish/, features/, migration/,
error-handling/, performance/, infrastructure/, and cli-side/ directories.

Each doc describes the problem, what remains to be done, and implementation
notes — readable without opening the GitHub issue. The migration plan tables
now link to these docs instead of bare issue references.
2026-02-25 14:03:23 +01:00

1.8 KiB

Surface CLI Startup Errors in the Extension

Priority: P1 Status: 🔨 Partial (assigned) Issue: #6209

Problem

If the CLI fails to start (e.g., due to a malformed opencode.json, missing binary, or port conflict), the extension gets stuck on "connecting to the server..." indefinitely. The user receives no feedback about what went wrong.

Common failure cases:

  • Malformed opencode.json — CLI exits immediately with a JSON parse error
  • Missing or corrupted CLI binary at bin/kilo
  • Another process already holding the port
  • OS permission denied when trying to execute the binary

Remaining Work

  • In ServerManager, detect when the CLI process exits unexpectedly (before a port is announced)
  • Capture the last N lines of stderr output from the process
  • Show a clear error notification to the user:
    • vscode.window.showErrorMessage('Kilo Code: Failed to start CLI server. ' + reason, 'Show Logs', 'Retry')
    • "Show Logs" should open the extension's output channel with the full stderr
    • "Retry" should attempt to restart the CLI process
  • Update the ConnectionState to a 'failed' state and show it in the webview (currently only 'connecting', 'connected', 'disconnected' states exist)
  • For the specific case of malformed config: parse the error message and show a human-readable hint ("Your opencode.json appears to be invalid JSON. Open it to fix?")

Implementation Notes

  • The ServerManager.start() method currently waits for a port line on stdout; add a process.on('exit', ...) handler to detect premature exit
  • Use the existing output channel from the Dedicated Output Channel work for "Show Logs"
  • See also: #6146 Propagate CLI Errors for the general error propagation case