gemini-cli - 💡(How to fix) Fix Infinite model invalidation loop in sub-agent invocation (invoke_agent) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#26146Fetched 2026-04-29 06:35:24
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
commented ×2labeled ×1mentioned ×1subscribed ×1

Error Message

  1. Even after manually selecting the "Switch to gemini-3-flash-preview" option, the error recurs on the very next turn of the sub-agent's execution, preventing any progress.
RAW_BUFFERClick to expand / collapse

What happened?

When attempting to invoke a sub-agent using the invoke_agent tool, the CLI enters an infinite loop of model rejection.

Steps to Reproduce:

  1. Create a sub-agent .md file in .gemini/agents/.
  2. Define model: gemini-3-flash-preview in the YAML frontmatter.
  3. Invoke the agent from the main session.
  4. The CLI returns: Model "gemini-3-flash" was not found or is invalid.
  5. Even after manually selecting the "Switch to gemini-3-flash-preview" option, the error recurs on the very next turn of the sub-agent's execution, preventing any progress.

It appears the CLI's internal mapping for sub-agents is defaulting to gemini-3-flash and ignoring both the frontmatter specification and the manually selected fallback for subsequent turns.

What did you expect to happen?

  1. The CLI should respect the model specified in the sub-agent's frontmatter.
  2. If a model fallback is selected manually during an agent run, that selection should persist for the duration of the task.
  3. In environments where the -preview suffix is mandatory, the CLI should automatically map base model names to their preview counterparts.

Client information

  • CLI Version: 0.39.1
  • Git Commit: 4d73f3413
  • Session ID: f54bb263-db42-423d-ad17-95d128c56b94
  • Operating System: linux v20.19.2
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3-flash-preview
  • Auth Type: oauth-personal
  • Memory Usage: 372.1 MB
  • Terminal Name: Konsole 25.04.2
  • Terminal Background: #232627
  • Kitty Keyboard Protocol: Unsupported
  • **Tier: Gemini Code Assist in Google One AI Pro
  • **Platform: Debian 13 (Trixie)

Login information

Logged in via Google Account (OAuth Personal) with active Google One AI Pro subscription.

Anything else we need to know?

The issue persists even after clearing the ~/.gemini/agents/ cache and restarting the CLI session. It seems to be a conflict between the CLI's hardcoded default model names for Gemini 3 and the specific requirements of the API endpoint in this region/environment.

extent analysis

TL;DR

The issue can be mitigated by manually specifying the full model name, including the "-preview" suffix, when invoking the sub-agent.

Guidance

  • Verify that the model name in the sub-agent's YAML frontmatter is correctly set to "gemini-3-flash-preview" to ensure consistency.
  • Try invoking the sub-agent with the full model name, including the "-preview" suffix, to see if the CLI respects this specification.
  • Check if there are any environment or region-specific settings that might be causing the CLI to default to "gemini-3-flash" instead of the specified model.
  • Consider reporting this as a bug to the development team, as the expected behavior is for the CLI to respect the model specified in the frontmatter and manual selections.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The issue seems to be related to a conflict between the CLI's hardcoded default model names and the specific requirements of the API endpoint in this region/environment. The provided guidance is based on the information given and might not be a permanent fix.

Recommendation

Apply workaround: Manually specify the full model name, including the "-preview" suffix, when invoking the sub-agent, as this seems to be the most direct way to mitigate the issue given the current information.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - 💡(How to fix) Fix Infinite model invalidation loop in sub-agent invocation (invoke_agent) [2 comments, 2 participants]