mirror of
https://github.com/HanaokaYuzu/Gemini-API.git
synced 2026-04-12 12:23:03 -06:00
Parsing Error (IndexError & Invalid Response) #112
Labels
No labels
advanced
advanced
bug
dependencies
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
model
pull-request
question
unreproducible
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mirrors/Gemini-API#112
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tminh159 on GitHub (Nov 25, 2025).
Logs:
| DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - IndexError: parsing failed at path [2] (index 0, key '2') while attempting to get value from
['di', 4168]| DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - IndexError: parsing failed at path [0, 5, 2, 0, 1, 0] (index 2, key '2') while attempting to get value from
[13]| DEBUG | gemini_webapi.client:generate_content:407 - Invalid response: )]}'
[["wrb.fr",null,null,null,null,[13]],["di",4168],["af.httprm",4168,"-7853133795714790678",48]]
...
Traceback (most recent call last):
File "client.py", line 383, in generate_content
match ErrorCode(error_code):
^^^^^^^^^^^^^^^^^^^^^
ValueError: -1 is not a valid ErrorCode
@wangjh9712 commented on GitHub (Nov 26, 2025):
+1 same
@faithleysath commented on GitHub (Nov 26, 2025):
paste your code that can reproduce error please, that will be great help.
@tminh159 commented on GitHub (Nov 26, 2025):
Some errors in the log aren’t reliably reproducible, even when using the same code, prompt, cookie, model, etc. Depend on the time of the day, I guess. But the IndexError never fails to appear.
@HanaokaYuzu commented on GitHub (Nov 26, 2025):
Sometimes generating content requests will fail with no valid response body and the reason is still not clear. It could be caused by server/network/frequency/account status or anything. If it just happens seldomly and randomly, please try implementing a retry logic in your code (this package will automatically retry for at most twice if error occurs, but just in case).
@wangjh9712 Please ignore those debug logs of IndexError. They just means your generation result is missing some of components (thoughts, generated image, etc.) and is an expected behavior. Like when you ask 1+1=? there won't be generated images in the response.