"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
What happened?
Attempt 1 failed with 5xx error. Retrying with backoff... _GaxiosError: [{
"error": {
"code": 400,
"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
"errors": [
{
"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
]
at Gaxios._request (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:51034:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async _OAuth2Client.requestAsync (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:52373:17)
at async CodeAssistServer.requestStreamingPost (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:78385:21)
at async CodeAssistServer.generateContentStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:78305:23)
at async retryWithBackoff (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:151117:14)
at async GeminiChat.sendMessageStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:205778:35)
at async Turn.run (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:150484:34)
at async GeminiClient.sendMessageStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:206487:26)
at async file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:253508:24 {
config: {
url: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse',
method: 'POST',
params: { alt: 'sse' },
headers: {
'Content-Type': 'application/json',
'User-Agent': 'GeminiCLI/0.1.13 (linux; x64) google-api-nodejs-client/9.15.1',
Authorization: '<errorRedactor option in gaxios for configuration>.',
'x-goog-api-client': 'gl-node/22.17.0'
},
responseType: 'stream',
body: '<errorRedactor option in gaxios for configuration>.',
signal: AbortSignal { aborted: false },
paramsSerializer: [Function: paramsSerializer],
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
response: {
config: {
url: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse',
method: 'POST',
params: [Object],
headers: [Object],
responseType: 'stream',
body: '<errorRedactor option in gaxios for configuration>.',
signal: [AbortSignal],
paramsSerializer: [Function: paramsSerializer],
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
data: '[{\n' +
' "error": {\n' +
' "code": 400,\n' +
' "message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",\n' +
' "errors": [\n' +
' {\n' +
' "message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",\n' +
' "domain": "global",\n' +
' "reason": "badRequest"\n' +
' }\n' +
' ],\n' +
' "status": "INVALID_ARGUMENT"\n' +
' }\n' +
'}\n' +
']',
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'content-length': '387',
'content-type': 'application/json; charset=UTF-8',
date: 'Tue, 22 Jul 2025 21:06:24 GMT',
server: 'ESF',
'server-timing': 'gfet4t7; dur=25980',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 400,
statusText: 'Bad Request',
request: {
responseURL: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse'
}
},
error: undefined,
status: 400,
[Symbol(gaxios-gaxios-error)]: '6.7.1'
}
Attempt 2 failed with 5xx error. Retrying with backoff... _GaxiosError: [{
"error": {
"code": 400,
"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
"errors": [
{
"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
]
at Gaxios._request (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:51034:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async _OAuth2Client.requestAsync (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:52373:17)
at async CodeAssistServer.requestStreamingPost (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:78385:21)
at async CodeAssistServer.generateContentStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:78305:23)
at async retryWithBackoff (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:151117:14)
at async GeminiChat.sendMessageStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:205778:35)
at async Turn.run (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:150484:34)
at async GeminiClient.sendMessageStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:206487:26)
at async file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:253508:24 {
config: {
url: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse',
method: 'POST',
params: { alt: 'sse' },
headers: {
'Content-Type': 'application/json',
'User-Agent': 'GeminiCLI/0.1.13 (linux; x64) google-api-nodejs-client/9.15.1',
Authorization: '<errorRedactor option in gaxios for configuration>.',
'x-goog-api-client': 'gl-node/22.17.0'
},
responseType: 'stream',
body: '<errorRedactor option in gaxios for configuration>.',
signal: AbortSignal { aborted: false },
paramsSerializer: [Function: paramsSerializer],
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
response: {
config: {
url: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse',
method: 'POST',
params: [Object],
headers: [Object],
responseType: 'stream',
body: '<errorRedactor option in gaxios for configuration>.',
signal: [AbortSignal],
paramsSerializer: [Function: paramsSerializer],
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
data: '[{\n' +
' "error": {\n' +
' "code": 400,\n' +
' "message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",\n' +
' "errors": [\n' +
' {\n' +
' "message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",\n' +
' "domain": "global",\n' +
' "reason": "badRequest"\n' +
' }\n' +
' ],\n' +
' "status": "INVALID_ARGUMENT"\n' +
' }\n' +
'}\n' +
']',
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'content-length': '387',
'content-type': 'application/json; charset=UTF-8',
date: 'Tue, 22 Jul 2025 21:06:55 GMT',
server: 'ESF',
'server-timing': 'gfet4t7; dur=25395',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 400,
statusText: 'Bad Request',
request: {
responseURL: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse'
}
},
error: undefined,
status: 400,
[Symbol(gaxios-gaxios-error)]: '6.7.1'
}
Attempt 3 failed with 5xx error. Retrying with backoff... _GaxiosError: [{
"error": {
"code": 400,
"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
"errors": [
{
"message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
]
at Gaxios._request (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:51034:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async _OAuth2Client.requestAsync (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:52373:17)
at async CodeAssistServer.requestStreamingPost (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:78385:21)
at async CodeAssistServer.generateContentStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:78305:23)
at async retryWithBackoff (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:151117:14)
at async GeminiChat.sendMessageStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:205778:35)
at async Turn.run (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:150484:34)
at async GeminiClient.sendMessageStream (file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:206487:26)
at async file:///home/shabev/.npm/_npx/38c708f8d73fe4c9/node_modules/@google/gemini-cli/bundle/gemini.js:253508:24 {
config: {
url: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse',
method: 'POST',
params: { alt: 'sse' },
headers: {
'Content-Type': 'application/json',
'User-Agent': 'GeminiCLI/0.1.13 (linux; x64) google-api-nodejs-client/9.15.1',
Authorization: '<errorRedactor option in gaxios for configuration>.',
'x-goog-api-client': 'gl-node/22.17.0'
},
responseType: 'stream',
body: '<errorRedactor option in gaxios for configuration>.',
signal: AbortSignal { aborted: false },
paramsSerializer: [Function: paramsSerializer],
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
response: {
config: {
url: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse',
method: 'POST',
params: [Object],
headers: [Object],
responseType: 'stream',
body: '<errorRedactor option in gaxios for configuration>.',
signal: [AbortSignal],
paramsSerializer: [Function: paramsSerializer],
validateStatus: [Function: validateStatus],
errorRedactor: [Function: defaultErrorRedactor]
},
data: '[{\n' +
' "error": {\n' +
' "code": 400,\n' +
' "message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",\n' +
' "errors": [\n' +
' {\n' +
' "message": "The input token count (2845475) exceeds the maximum number of tokens allowed (1048576).",\n' +
' "domain": "global",\n' +
' "reason": "badRequest"\n' +
' }\n' +
' ],\n' +
' "status": "INVALID_ARGUMENT"\n' +
' }\n' +
'}\n' +
']',
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'content-length': '387',
'content-type': 'application/json; charset=UTF-8',
date: 'Tue, 22 Jul 2025 21:07:30 GMT',
server: 'ESF',
'server-timing': 'gfet4t7; dur=27098',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 400,
statusText: 'Bad Request',
request: {
responseURL: 'https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse'
}
},
error: undefined,
status: 400,
[Symbol(gaxios-gaxios-error)]: '6.7.1'
}
Flushing log events to Clearcut.
ℹ Request cancelled.
✕ [API Error: Cannot read properties of undefined (reading 'error')]
What did you expect to happen?
IDK maybe its supposed to divide file into chunks before parsing it?
Client information
$ gemini /about
CLI Version 0.1.13
Model gemini-2.5-pro
Sandbox no sandbox
OS linux
Auth Method OAuth
Login information
No response
Anything else we need to know?
No response
Whoa. What did you do to get 2 million tokens. You might have attached too much context or something.
Have you tried running the /compress command? That should help.
Closing this as a duplicate because I suspect you just were trying to include too many files. Please reopen if I'm mistaken.