Error: Request contains an invalid argument.
What happened?
{
"error": {
"message": "[{\n \"error\": {\n \"code\": 400,\n \"message\": \"Request contains an invalid argument.\",\n \"errors\": [\n {\n \"message\": \"Request contains an invalid argument.\",\n \"domain\": \"global\",\n \"reason\": \"badRequest\"\n }\n ],\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n]",
"stack": "Error: [{\n \"error\": {\n \"code\": 400,\n \"message\": \"Request contains an invalid argument.\",\n \"errors\": [\n {\n \"message\": \"Request contains an invalid argument.\",\n \"domain\": \"global\",\n \"reason\": \"badRequest\"\n }\n ],\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n]\n at Gaxios._request (/Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/gaxios/build/src/gaxios.js:142:23)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async OAuth2Client.requestAsync (/Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/google-auth-library/build/src/auth/oauth2client.js:429:18)\n at async CodeAssistServer.requestStreamingPost (file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/code_assist/server.js:109:21)\n at async CodeAssistServer.generateContentStream (file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/code_assist/server.js:25:23)\n at async file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/core/loggingContentGenerator.js:121:26\n at async retryWithBackoff (file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/utils/retry.js:108:28)\n at async GeminiChat.makeApiCallAndProcessStream (file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:411:32)\n at async GeminiChat.streamWithRetries (file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:236:40)\n at async Turn.run (file:///Users/cr/.npm/_npx/64b0c08c6e69aa1c/node_modules/@google/gemini-cli-core/dist/src/core/turn.js:60:30)"
},
"context": [
What did you expect to happen?
No error
Client information
- CLI Version: 0.22.0-preview.1
- Git Commit: 76414c1cc
- Session ID: b54b01ef-458b-4131-aea1-28f569d51f9e
- Operating System: darwin v24.11.0
- Sandbox Environment: no sandbox
- Model Version: auto-gemini-3
- Memory Usage: 418.5 MB
Login information
No response
Anything else we need to know?
Compression also failed. Sad.
Hi @corneliusroemer,
Thanks for reporting this issue, to help us narrow this down, could you provide a bit more detail on what was happening when the crash occurred?
Questions to help us debug:
-
What was your intent? Were you running a general chat command, or were you trying to use a specific feature like code explanation or refactoring?
-
Did you include a file? If you were passing a file (or multiple files) to the CLI, what was the file type (e.g., .js, .py, .pdf) and roughly how large was it?
-
The "Compression failed" note: You mentioned compression failed right before the error. Were you attempting to send a large folder or a codebase that might have triggered an automatic compression step? Did you have a long chat session?
What was your intent? Were you running a general chat command, or were you trying to use a specific feature like code explanation or refactoring?
General chat, nothing specific. There was a warning about me approaching the context limit. That the next message would use compression.
Did you include a file? If you were passing a file (or multiple files) to the CLI, what was the file type (e.g., .js, .py, .pdf) and roughly how large was it?
No file passed. Just chat commands. There was a lot of output from a shell call to ./gradlew dependencies or something like that.
The "Compression failed" note: You mentioned compression failed right before the error. Were you attempting to send a large folder or a codebase that might have triggered an automatic compression step? Did you have a long chat session?
Compression failed after the error. I didn't try compressing before, manually. I was told that compression would happen - but it didn't happen, I got the error instead. I tried to save the situation by manually compressing but then the compressing failed.
I'm working on sharing the error details. Just checking there's nothing sensitive in there.
I can reproduce it (though it's not how I encountered the error, but seems similar): The shell tool can do things like catting a massive file to the point where the context is too large:
I can reproduce it (though it's not how I encountered the error, but seems similar): The shell tool can do things like
catting a massive file to the point where the context is too large:
![]()
The samething here.
