Skip to content

Conversation

@benzntech
Copy link
Contributor

Summary

This PR improves the CLI error message when a custom mode is not found, addressing issues #4575 and #4600.

Changes

cli/src/config/customModes.ts

  • Added SearchedPath interface to track search locations
  • Added getSearchedPaths() export for error reporting
  • Added debug logging for mode loading/failures
  • Refactored loading functions to return path metadata

cli/src/index.ts

  • Replaced misleading "Invalid mode" error with informative "Mode not found" message
  • Shows exactly where CLI searched for custom modes (global and project paths)

cli/src/config/__tests__/customModes.test.ts

  • Added 14 comprehensive unit tests

Before

Error: Invalid mode "my-mode". Valid modes are: code, architect, ask, debug, orchestrator

After

Error: Mode "my-mode" not found.

The CLI searched for custom modes in:
  • Global: ~/Library/.../custom_modes.yaml (not found)
  • Project: /workspace/.kilocodemodes (not found)

Available modes: code, architect, ask, debug, orchestrator

Testing

  • All 14 new tests pass

Fixes #4575
Fixes #4600

@changeset-bot
Copy link

changeset-bot bot commented Jan 7, 2026

🦋 Changeset detected

Latest commit: 9b61697

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

@marius-kilocode
Copy link
Collaborator

@benzntech Appears to me that the PR's are stacked on top of each other? Would you be able to split the CLI from the PR? Or are they dependent? Thanks!

- Changed error from 'Invalid mode' to 'Mode not found' with search path details
- Added SearchedPath interface and getSearchedPaths() export for error reporting
- Added debug logging to help diagnose custom modes loading issues
- Shows exactly where CLI searched for custom modes (global and project paths)
- Added 14 unit tests for customModes.ts

Fixes Kilo-Org#4575, fixes Kilo-Org#4600
@benzntech benzntech force-pushed the fix/cli-custom-modes-error-message branch from 91381bc to 8fcf303 Compare January 8, 2026 04:01
@benzntech
Copy link
Contributor Author

@benzntech Appears to me that the PR's are stacked on top of each other? Would you be able to split the CLI from the PR? Or are they dependent? Thanks!

updated @marius-kilocode

@marius-kilocode
Copy link
Collaborator

marius-kilocode commented Jan 9, 2026

Looks like a good improvement for usability @benzntech .
Would it make sense to then also align the error message users get when changing the mode within the CLI itself (see screenshot)? Because that one still shows the old error message.

In the best case we reuse the same mechanism for both cases:

  • kilo --mode does-not-exist
  • /mode does-not-exist
image

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.

Improve error message for custom mode not found during CLI initialization custom modes support for cli do not works

2 participants