-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Description
What happened?
I ran the following command to check file counts in headless mode:
gemini -p "how many files in this folder"
The model immediately failed with Tool "run_shell_command" not found in registry.
I found that while the shell tool is correctly excluded from the registry in headless mode, prompts.ts still hardcodes instructions to use it:
- Line 292: Lists
'${SHELL_TOOL_NAME}'inprimaryWorkflows_suffix. - Line 364: Explicitly instructs:
- **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool...
The model is simply following the system prompt instructions, but crashes because the tool schema is missing.
What did you expect to happen?
The system prompt should not reference or instruct the use of tools that are not in the current registry.
Suggested Fix:
Make shell-related instructions in prompts.ts conditional on the tool's availability.
const shellInstructions = config.getToolRegistry().getTool(SHELL_TOOL_NAME)
? `- **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool...`
: '';Client information
│ About Gemini CLI │
│ │
│ CLI Version 0.22.5 │
│ Git Commit 8daf2d3 │
│ Model gemini-3-pro-preview │
│ Sandbox no sandbox │
│ OS darwin │
│ Auth Method OAuth
Login information
OAuth
Anything else we need to know?
Note while this did not reproduce every time, based on my quick analysis it seems like a real bug worth fixing.
Update: I actually was able to reproduce it again, does not always happen but now 3x.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status