API Error: Unexpected line format in response:
Describe the bug When asking for "how to run in sandbox", it returns API Error
Client information Windows
Additional context Nope
I think it should prompt the user to login/provide API instead of returning the error? Didnt experience this when using WSL + windows
I think in your example the request fully succeeded on the "how to run in sandbox?" and only failed on the subsequent "how does the restriction work?" It would have failed on the first if your authentication wasn't configured
same
https://developers.google.com/gemini-code-assist/resources/available-locations Gemini CLI / Code assist plugin might be not available for you, if your personal gmail account bounded to country not in this list ^^.
The same error occurred to me halfway through a prompt.
(Original prompt: "create an ecommerce website with plain php, html, css, js and use sqlite as db")
I just asked it to continue the previous command and it successfully did.
Model: gemini-2.5-flash
System: WSL2 (Ubuntu)
After upgrading to version 0.6.0 I hit the same issue:(( I am using Windows 11 and standard Terminal
✕ [API Error: Unexpected line format in response: ,]
/about gives me
│ │ │ About Gemini CLI │ │ │ │ CLI Version 0.6.0 │ │ Git Commit 7e1bce72 │ │ Model gemini-2.5-pro │ │ Sandbox no sandbox │ │ OS win32 │ │ Auth Method OAuth │ │
Debug Console (ctrl+o to close) │
│ │
│ ℹ File C:\Users\xxx\.cache/vscode-ripgrep/ripgrep-v13.0.0-10-x86_64-pc-windows-msvc.zip has │
│ been cached │
│ ℹ Authenticated via "oauth-personal". │
│ ✖ Error when talking to Gemini API Full report available at: │
│ C:\Users\xxx\AppData\Local\Temp\gemini-client-error-Turn.run-sendMessageStream-2025-09-24T14-2 │
│ 8-16-196Z.json
and the report with sensitive data removed.
{
"error": {
"message": "Unexpected line format in response: ,",
"stack": "Error: Unexpected line format in response: ,\n at file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/code_assist/server.js:128:27\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/code_assist/server.js:27:30\n at async LoggingContentGenerator.loggingStreamWrapper (file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/loggingContentGenerator.js:70:30)\n at async GeminiChat.stopBeforeSecondMutator (file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:484:26)\n at async GeminiChat.processStreamResponse (file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:374:26)\n at async file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:212:42\n at async Turn.run (file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/turn.js:59:30)\n at async GeminiClient.sendMessageStream (file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/client.js:390:26)\n at async file:///C:/Users/xxx/AppData/Roaming/npm/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:402:26"
},
"context": [
{
"role": "user",
"parts": [
{
"text": "This is the Gemini CLI. We are setting up the context for our chat.\nToday's date is Wednesday, 24 September 2025 (formatted according to the user's locale).\nMy operating system is: win32\nI'm currently working in the directory: C:\\dev\\projects\\xxx\nHere is the folder structure of the current working directories:\n\nShowing up to 200 items (files + folders). Folders or files indicated with ... contain more items not shown, were ignored, or the display limit (200 items) was reached.\n\nC:\\dev\\projects\\xxx\\\n├───.gitignore\n├───bitbucket-pipelines.yml\n├───Dockerfile\n├───pom.xml\n├───settings.xml\n├───.git\\...\n├───.idea\\\n│ └───dataSources\\...\n├───logs\\\n├───src\\\n│ ├───db\\\n│ │ ..."
}
]
},
{
"role": "model",
"parts": [
{
"text": "Got it. Thanks for the context!"
}
]
},
{
"role": "user",
"parts": [
{
"text": "Can you migrate @src/main/java/com/xxx/app/integration/jira/SearchClient.java to use new v3 api ││ (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get) ie. use page tokens"
},
{
"text": "\n--- Content from referenced files ---"
},
{
"text": "\nContent from @C:\\dev\\projects\\xxx\\src\\main\\java\\com\\xxx\\app\\integration\\jira\\SearchClient.java:\n"
},
{
"text": "file content..."
},
{
"text": "\n--- End of content ---"
}
]
},
[
{
"text": "Can you migrate @src/main/java/com/xxx/app/integration/jira/SearchClient.java to use new v3 api ││ (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get) ie. use page tokens"
},
{
"text": "\n--- Content from referenced files ---"
},
{
"text": "\nContent from @C:\\dev\\projects\\xxx\\src\\main\\java\\com\\xxx\\app\\integration\\jira\\SearchClient.java:\n"
},
{
"text": "file content..."
},
{
"text": "\n--- End of content ---"
}
]
]
}
I tried to reinstalling gemini cli, and reauthenticating (using oath). I also asked some stupid questions like what's the capital of UK and model responded correctly.
I am having the same issue running Gemini CLI 0.6.1 on macOS 15.6.1
It's working again for me but now from time to time I get ✕ [API Error: Model stream ended with an invalid chunk or missing finish reason.]
I have the same issue with EVERY prompt I try - what a piece of garbage - google, are you interested in fixing this bug or what? I am using 0.7.0 on MacOS 15.6 - authentication via oauth. Here's the error:
{ "error": { "message": "Unexpected line format in response: ,", "stack": "Error: Unexpected line format in response: ,\n at file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/code_assist/server.js:128:27\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/code_assist/server.js:27:30\n at async LoggingContentGenerator.loggingStreamWrapper (file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/loggingContentGenerator.js:70:30)\n at async GeminiChat.stopBeforeSecondMutator (file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:480:26)\n at async GeminiChat.processStreamResponse (file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:374:26)\n at async file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/geminiChat.js:215:42\n at async Turn.run (file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/turn.js:59:30)\n at async GeminiClient.sendMessageStream (file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/client.js:405:26)\n at async file:///Users/shanna.murry/.nodenv/versions/20.19.3/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:401:26" },
@allenhutchison you marked 3 threads as duplicates, and at this point SCORES of people have reported this issue, will this ever be addressed by the Gemini CLI team, or are these just going to be reported ad infinitum with zero response?
Same issue
@jazir555 I appreciate your frustration. Part of our triage process is to consolidate duplicates down to a single issue so that we can make prioritization decisions for the core team. We are actively trying to fix quality of life and product issues over the last few weeks and as a part of that are working very hard to make sure the product is stable and works correctly. This particular issue seems to be pretty tricky to fix, and involves a lot of moving parts between our application and the model api.
@jazir555 I appreciate your frustration. Part of our triage process is to consolidate duplicates down to a single issue so that we can make prioritization decisions for the core team. We are actively trying to fix quality of life and product issues over the last few weeks and as a part of that are working very hard to make sure the product is stable and works correctly. This particular issue seems to be pretty tricky to fix, and involves a lot of moving parts between our application and the model api.
Thanks for getting back to me. The API errors are much more widespread than this, I think I've had at least 6 different unique error codes that are API based, I had opened issues for all the ones I encountered.
Hello! As part of our effort to keep our backlog manageable and focus on the most active issues, we are tidying up older reports.
It looks like this issue hasn't been active for a while, so we are closing it for now. However, if you are still experiencing this bug on the latest stable build, please feel free to comment on this issue or create a new one with updated details.
Thank you for your contribution!
So to confirm, you aren't actually going to fix the API errors then? You'll just let these be issues permanently? @kklashtorny1
So to confirm, you aren't actually going to fix the API errors then? You'll just let these be issues permanently? @kklashtorny1
Hi @jazir555, could you please confirm if you are still experiencing this issue and provide updated Gemini CLI configuration details?