Skip to content

itellm.APIConnectionError: Error parsing chunk: Expecting property name enclosed in double quotes #3648

Closed
@etheaven

Description

@etheaven

Issue

I add multiple files for both editable(4) and readonly(5)
I prepare bigger prompt for "/paste"
LLM starts replying a bit, but in the middle of it, I get an error:

itellm.APIConnectionError: Error parsing chunk: Expecting property name enclosed in double quotes: line 1 column 2 (char
1),
Received chunk: {
Traceback (most recent call last):
  File
"C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\litellm\llms\vertex_ai\gemini\vertex_and_google_ai
_studio_gemini.py", line 1469, in __next__
    return self._common_chunk_parsing_logic(chunk=chunk)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\litellm\llms\vertex_ai\gemini\vertex_and_google_ai
_studio_gemini.py", line 1443, in _common_chunk_parsing_logic
    return self.handle_valid_json_chunk(chunk=chunk)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\litellm\llms\vertex_ai\gemini\vertex_and_google_ai
_studio_gemini.py", line 1403, in handle_valid_json_chunk
    raise e
  File
"C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\litellm\llms\vertex_ai\gemini\vertex_and_google_ai
_studio_gemini.py", line 1395, in handle_valid_json_chunk
    json_chunk = json.loads(chunk)
                 ^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File
"C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\litellm\litellm_core_utils\streaming_handler.py",
line 1543, in __next__
    chunk = next(self.completion_stream)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\litellm\llms\vertex_ai\gemini\vertex_and_google_ai
_studio_gemini.py", line 1473, in __next__

aider tries to finish the request but keeps running into the error

Version and model info

Aider v0.79.0
Model: gemini/gemini-2.5-pro-exp-03-25 with diff-fenced edit format
Git repo: .git with 52 files
Repo-map: using 4096 tokens, auto refresh

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions