google-gemini / google-gemini/gemini-cli

BUG: `codebase_investigator` Agent Fails to Initialize in Gemini CLI

Open
#17,648 2 comments 0 reactions 0 assignees View on GitHub
🔒 maintainer only area/agent kind/bug priority/p2 status/bot-triaged status/need-information workstream-rollup
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## Summary
When attempting to delegate tasks to the `codebase_investigator` agent in Gemini CLI, the process repeatedly fails schema validation. The CLI consumes quota in a loop without successfully launching the agent.

## Environment
- **Gemini CLI version**: (v0.25.2)
- **Model used**: `gemini-2.5-flash`
- **OS**: Windows (user-level settings confirmed)
- **Settings.json**:
```json
{
"ide": { "hasSeenNudge": true },
"security": { "auth": { "selectedType": "gemini-api-key" } },
"ui": { "theme": "ANSI" },
"general": { "vimMode": false, "previewFeatures": true },
"tools": { "shell": { "showColor": false } },
"model": { "name": "gemini-2.5-flash" }
}
```

## Steps to Reproduce
1. Run a delegate command targeting `codebase_investigator`.
2. Observe CLI output:
- Missing `agent_name` error.
- After correction, missing `objective` and `question` errors.
- CLI retries indefinitely, consuming quota.

## Actual Behavior
- CLI fails schema validation for agent parameters.
- Infinite retry loop until quota is exhausted.
- No successful delegation to `codebase_investigator`.

## Expected Behavior
- CLI should construct valid parameters including:
```json
{
"agent_name": "codebase_investigator",
"objective": "High-level task goal",
"question": "Specific query about the codebase"
}
```
- Agent should initialize and return a structured `CodebaseInvestigationReport`.

## Possible Causes
- **Model mismatch**: `gemini-2.5-flash` may simplify or omit required fields when generating structured JSON, leading to schema validation errors.
- **CLI version/schema drift**: If CLI is upgraded but the model prompt templates are outdated, parameter construction may not align with the latest schema requirements.

## Suggested Fixes
- Validate schema before sending requests to avoid quota-draining loops.
- Provide clearer error messages indicating which fields are missing.
- Consider default fallbacks for `objective` and `question` when omitted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.