google-gemini / google-gemini/gemini-cli

API error 400 Request contains an invalid argument.

Open
#29,235 3 comments 1 reaction 0 assignees View on GitHub
area/agent kind/bug priority/p2 status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

### What happened?

[ACTION REQUIRED] 📎 PLEASE ATTACH THE EXPORTED CHAT HISTORY JSON FILE TO THIS ISSUE IF YOU FEEL COMFORTABLE SHARING IT

### What did you expect to happen?

It started to happen often that i have this message at the end of an AI's response:
[API Error: [{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
]]

After the first error message the AI answer with this error at every request, i have to close the session and resume it.

### Client information

* **CLI Version:** 0.58.0
* **Git Commit:** ac9431c9e
* **Session ID:** 05d99561-7ff8-4452-82b3-755e1419d99c
* **Operating System:** darwin v23.6.0
* **Sandbox Environment:** no sandbox
* **Model Version:** auto-gemini-2.5
* **Auth Type:** oauth-personal
* **Memory Usage:** 202.0 MB
* **Terminal Name:** Unknown
* **Terminal Background:** #191a1c
* **Kitty Keyboard Protocol:** Unsupported
* **IDE Client:** PhpStorm 2026.2.2

### Login information

_No response_

### Anything else we need to know?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the repeated 400 INVALID_ARGUMENT response in gemini-cli 0.58.0 with the reported auto-gemini-2.5 model and OAuth authentication. The issue does not identify a file, test, request argument, or reliable reproduction steps, so first inspect the CLI's API request and session-resume paths. Done means identifying the invalid request or state transition and preventing the error from recurring on every request.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.