Skip to content

fix(cli): Add error handling to prevent silent failures#5687

Closed
Ashwinhegde19 wants to merge 1 commit intoKilo-Org:mainfrom
Ashwinhegde19:fix/cli-silent-failures
Closed

fix(cli): Add error handling to prevent silent failures#5687
Ashwinhegde19 wants to merge 1 commit intoKilo-Org:mainfrom
Ashwinhegde19:fix/cli-silent-failures

Conversation

@Ashwinhegde19
Copy link
Contributor

@Ashwinhegde19 Ashwinhegde19 commented Feb 5, 2026

Fixes #5683

Problem

The CLI was exiting silently without any output when errors occurred during startup. This happened because there were no error handlers for uncaught exceptions or unhandled promise rejections.

Solution

Added comprehensive error handling:

  1. Global error handlers:

    • uncaughtException - catches synchronous errors
    • unhandledRejection - catches async promise rejections
  2. Program parsing:

    • Changed program.parse() to program.parseAsync().catch() to catch Commander.js errors
  3. Subcommand wrappers:

    • Added try-catch blocks to auth, debug, and models commands

Testing Completed ✅

Manual CLI Testing:

  • --help displays correctly: Shows full help output
  • --version works: Returns 0.26.1
  • Invalid flags show errors: Displays error: unknown option '--invalid-flag'
  • Debug command works: Shows available modes
  • Models command shows proper error: JSON error response instead of silent exit
  • No config shows error message: Proper error instead of silent failure

Unit Tests:

  • All 2078 tests passed
  • 120 test files passed
  • Duration: 49.53s

Checklist

  • Changeset created
  • Follows contribution guidelines
  • Commit message follows conventions
  • All tests passing

Add uncaughtException and unhandledRejection handlers to ensure
errors are displayed instead of exiting silently. Wrap subcommands
and program parsing in try-catch blocks.

Fixes Kilo-Org#5683
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: e532ff7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@olearycrew
Copy link
Contributor

Hi @Ashwinhegde19 - thank you for taking the time to contribute to this project—we really appreciate it.

We've recently re-platformed the Kilo CLI with a complete rebuild based on OpenCode as our new foundation, which means this PR unfortunately won't be compatible with the new architecture. You can read more about why we made this change here: https://blog.kilo.ai/p/kilo-cli

If you think this feature or fix is still relevant, we'd love for you to check out the new CLI and consider contributing there: https://github.com/Kilo-Org/kilo

I sent you a DM on Discord @olearycrew so that we can show our appreciation in a more tangible way too

Thanks again for your support!

@olearycrew olearycrew closed this Feb 5, 2026
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.

CLI doesn't run, no output, on latest version

2 participants