Skip to content

trying to read pdf files is causing issues #21390

Closed as not planned
Closed as not planned

Description

@ephraimbhaskar13

Description

Bug Description

The Read tool consistently fails when attempting to read PDF files, returning "Invalid request Error". Text and markdown files work fine.

Steps to Reproduce

  1. Try to read any PDF file using the Read tool
  2. Observe "Invalid request Error"

Tested Files

  • ~/Downloads/Movingtech/www.movingtech.com.pdf (2.5MB) - Failed
  • ~/Downloads/Invoice-SZJ9D-0001.pdf (<500KB) - Failed
  • Same files converted to .txt using pdfplumber - Worked

Environment

  • Platform: macOS (darwin)
  • Tool: Read
  • File formats tested: .pdf (fails), .md (works), .txt (works)

Workaround

Convert PDFs to text before reading:

pip3 install pdfplumber
python3 -c "import pdfplumber; print(pdfplumber.open('file.pdf').pages[0].extract_text())"
Expected Behavior
PDF files should be readable like other document formats, or documentation should indicate PDF is not supported.

### Plugins

_No response_

### OpenCode version

_No response_

### Steps to reproduce

_No response_

### Screenshot and/or share link

_No response_

### Operating System

_No response_

### Terminal

_No response_

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 7, 2026
  2. github-actions commented on Apr 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review these issues to see if your problem is already being tracked. If your issue is different, feel free to add clarifying details.

  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. zhiyiwang-byte commented on Jun 8, 2026

    @zhiyiwang-byte

    I've investigated this issue and identified the root cause. The crash happens because prompt.ts:993 uses Effect.catch(Effect.die) which converts file read IO errors into unrecoverable defects during user attachment processing.

    I've opened a fix PR: #31329

  5. github-actions commented on Aug 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions