load_data errors out with "The error "Error while parsing the file '<bytes/buffer>': file_name must be provided in extra_info when passing bytes" #415

Closed
opened 2026-02-16 00:17:47 -05:00 by yindo · 1 comment
Owner

Originally created by @DanielNeedles on GitHub (Jan 30, 2025).

Describe the bug
Attempts to parse any PDF generates the error:
The error "Error while parsing the file '<bytes/buffer>': file_name must be provided in extra_info when passing bytes"

This short script recreates the problem:

    import os
    from typing import List, Tuple
    from dotenv import load_dotenv
    from llama_index.core import SimpleDirectoryReader
    from llama_parse import LlamaParse

    pdf_path='IPC_highview-2pgs.pdf'
    load_dotenv()
    api_key = os.getenv('LLAMA_CLOUD_API_KEY')
    parser = LlamaParse(api_key=api_key)

    print(f"Parsing PDF: {pdf_path}")
    with open(pdf_path, 'rb') as pdf_file:
        documents = parser.load_data(pdf_file)`

Files
Any PDF generates the issue.

Job ID
No job shows up in history.

Client:
Please remove untested options:

  • Python Library
  • API
  • Frontend (cloud.llamaindex.ai)
  • Typescript Library
  • Notebook

Additional context
Add any additional context about the problem here.
What options did you use? Premium mode, multimodal, fast mode, parsing instructions, etc.
Screenshots, code snippets, etc.

Originally created by @DanielNeedles on GitHub (Jan 30, 2025). **Describe the bug** Attempts to parse any PDF generates the error: The error "Error while parsing the file '<bytes/buffer>': file_name must be provided in extra_info when passing bytes" This short script recreates the problem: import os from typing import List, Tuple from dotenv import load_dotenv from llama_index.core import SimpleDirectoryReader from llama_parse import LlamaParse pdf_path='IPC_highview-2pgs.pdf' load_dotenv() api_key = os.getenv('LLAMA_CLOUD_API_KEY') parser = LlamaParse(api_key=api_key) print(f"Parsing PDF: {pdf_path}") with open(pdf_path, 'rb') as pdf_file: documents = parser.load_data(pdf_file)` **Files** Any PDF generates the issue. **Job ID** No job shows up in history. **Client:** Please remove untested options: - Python Library - API - Frontend (cloud.llamaindex.ai) - Typescript Library - Notebook **Additional context** Add any additional context about the problem here. What options did you use? Premium mode, multimodal, fast mode, parsing instructions, etc. Screenshots, code snippets, etc.
yindo added the bug label 2026-02-16 00:17:47 -05:00
yindo closed this issue 2026-02-16 00:17:47 -05:00
Author
Owner

@logan-markewich commented on GitHub (Jan 30, 2025):

As the error stated, you need to supply a file name

parser.load_data(file_bytes, extra_info={"file_name": "some_file.pdf"})

@logan-markewich commented on GitHub (Jan 30, 2025): As the error stated, you need to supply a file name `parser.load_data(file_bytes, extra_info={"file_name": "some_file.pdf"})`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#415