Skip to content

Unable to process long pdf files #2039

Description

@nicoloceneda

What happened?

Gemini cli breaks down when asked to process long pdf files. It works just fine with short pdfs, but if you ask to process a long one, such as a book, the chain of though shows it is thinking about unrelated stuff (such as funny memes) and eventually the process returns an error. See the following example:

What is the book @Interest-Rate-Models.pdf about?

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔  ReadManyFiles Will attempt to read and concatenate files using patterns: `Interest-Rate-Models.pdf` (wit… │
│                                                                                                              │
│    ### ReadManyFiles Result (Target Dir:                                                                     │
│    `/Users/nicoloceneda/Library/CloudStorage/Dropbox/University/books`)                                      │
│                                                                                                              │
│    Successfully read and concatenated content from **1 file(s)**.                                            │
│                                                                                                              │
│    **Processed Files:**                                                                                      │
│    - `Interest-Rate-Models.pdf`                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✕ [API Error: [{
   "error": {
     "code": 500,
     "message": "Internal error encountered.",
     "errors": [
       {
         "message": "Internal error encountered.",
         "domain": "global",
         "reason": "backendError"
       }
     ],
     "status": "INTERNAL"
   }
 }
 ]]

What did you expect to happen?

Gemini cli should have processes the pdf correctly.

Client information

Details
│ CLI Version            0.1.1                                       │
│ Git Commit             852210e1 (local modifications)              │
│ Model                  gemini-2.5-pro                              │
│ Sandbox                no sandbox                                  │
│ OS                     darwin   

Login information

Google Account

Anything else we need to know?

The file size is was 9.2MB, and the same command works just fine in the web interface.

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