Skip to content

API Error: request to https://cloudcode-pa.googleapis.com/v1internal:countTokens failed, reason: write ERANGE #8412

@forest3721

Description

@forest3721

What happened?

I asked gemini to perform the following tasks:
"go over all the 18 applications one by one, focus on academia only, which means looking at transcript, school grade, extracurrium activities and awards on │
│ STEM (e.g., coding, latin, math etc), and research achievement (e.g. admission and publications in highly recognizable research institute, top level │
│ competition awards, summarize and document the outstanding achievements of the applicant if there is any. Finally, produce a rank of all the applications in │
│ academia achievement."

Each application folder has a few pdf files like resume and etc. I have logged to my Google account, which has access to the Gemini 2.5 pro.

Gemini was able to process a few candidates without any issue, but then constantly return this error:
"API Error: request to https://cloudcode-pa.googleapis.com/v1internal:countTokens failed, reason: write ERANGE"

I asked it to "proceed". Sometimes it was able to continue. Other times, it just returned the same error again.

The error message is hard to understand. I am guessing this is some form of rate limiting?

What did you expect to happen?

Clearer error messages that are more actionable:

  1. switch the model
  2. reduce the task size
  3. raise the limit
    ?

Client information

  • CLI Version: 0.3.3
  • Git Commit: ddd4659
  • Session ID: 61a4d62c-48e0-4bb6-b9cb-7dc0e479d0ae
  • Operating System: darwin v22.17.1
  • Sandbox Environment: no sandbox
  • Model Version: gemini-2.5-pro
  • Memory Usage: 516.0 MB

Login information

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalepriority/p2Important but can be addressed in a future release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions