What happened?
When i input JavaScript code that starts with comments using //, the gemini-cli incorrectly interprets these as slash commands and throws an "Unknown command" error.
For example, inputting this JavaScript code:
// check if variants base info all filled.
if(!objDetCtrl.variantInfo.baseInfo.title) {
toastr.error('[Title] cannot be empty.')
return false
}
if(!objDetCtrl.variantInfo.baseInfo.description) {
toastr.error('[Description] cannot be empty.')
return false
}
if(!objDetCtrl.variantInfo.options.length) {
toastr.error('[Variants] cannot be empty.')
return false
}
Results in the error:

What did you expect to happen?
The CLI should treat this input as regular text/code content to be processed by Gemini, not as a command. JavaScript comments starting with // should not trigger the slash command parser.
Root Cause:
In packages/cli/src/ui/hooks/slashCommandProcessor.ts line 263, the condition trimmed.startsWith('/') catches both legitimate slash commands (like /help) and JavaScript comments (//comment), causing the parser to incorrectly attempt to process code comments as commands.
Expected Behavior:
- Single / followed by a command name should be parsed as slash commands
- Double // should be treated as regular text content (JavaScript/C++ style comments)
- The CLI should only interpret intentional command syntax, not common programming language constructs
Client information
Details
$ gemini /about
CLI Version 0.1.21 │
│ Git Commit 5bba15b0 │
│ Model gemini-2.5-pro │
│ Sandbox no sandbox │
│ OS darwin │
│ Auth Method OAuth │
│ License Free Tier (Login with Google) │
│ IDE Client VS Code │
│
Login information
No response
Anything else we need to know?
// and /* will both affect the judgment of the gemini command.
What happened?
When i input JavaScript code that starts with comments using //, the gemini-cli incorrectly interprets these as slash commands and throws an "Unknown command" error.
For example, inputting this JavaScript code:
Results in the error:
What did you expect to happen?
The CLI should treat this input as regular text/code content to be processed by Gemini, not as a command. JavaScript comments starting with // should not trigger the slash command parser.
Root Cause:
In
packages/cli/src/ui/hooks/slashCommandProcessor.tsline 263, the condition trimmed.startsWith('/') catches both legitimate slash commands (like /help) and JavaScript comments (//comment), causing the parser to incorrectly attempt to process code comments as commands.Expected Behavior:
Client information
Details
Login information
No response
Anything else we need to know?
// and /* will both affect the judgment of the gemini command.