[Bug]: LlamaParse.parse() not able to parse CSVs #485

Closed
opened 2026-02-16 00:17:59 -05:00 by yindo · 7 comments
Owner

Originally created by @emclaughlin215 on GitHub (Jun 4, 2025).

Bug Description

Hi,

I am trying to get Llama parse to parse csv and XML files but I am getting the following error, indicating that the returned object does not pass the required pydantic base model validation.

  File "/Users/edward/Documents/git/pythonLocal/file-text-extraction/llama-parse/./llama-parse.py", line 28, in main
    result = parser.parse(
  File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_cloud_services/parse/base.py", line 1199, in parse
    return asyncio_run(self.aparse(file_path, extra_info, fs=fs))
  File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_index/core/async_utils.py", line 52, in asyncio_run
    return loop.run_until_complete(coro)
  File "/opt/homebrew/Cellar/python@3.10/3.10.16/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_cloud_services/parse/base.py", line 1116, in aparse
    return JobResult(
  File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_cloud_services/parse/types.py", line 179, in __init__
    super().__init__(job_id=job_id, file_name=file_name, **job_result)
  File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/pydantic/main.py", line 253, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 6 validation errors for JobResult
pages.0.status
  Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
pages.0.triggeredAutoMode
  Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
pages.0.parsingMode
  Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
pages.0.structuredData
  Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
pages.0.noStructuredContent
  Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
pages.0.noTextContent
  Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing

My testing file is:

from llama_cloud_services import LlamaParse

API_KEY = {API KEY}

parser = LlamaParse(
    api_key=API_KEY, 
    base_url="https://api.cloud.eu.llamaindex.ai",
    num_workers=1,
    language="en"
)

def main():
    file_type = "csv"

    # sync
    result = parser.parse(
        f"./{file_name}.{file_type}",
    )

    with open(
        f"./{file_type}/{file_name}-output.txt",
        "w",
        encoding="utf-8",
    ) as f:
        f.write(result.get_text_documents(split_by_page=False)[0].text_resource.text)


if __name__ == "__main__":
    main()

And when i put a breakpoint in JobResult.__init__() before super().__init__(job_id=job_id, file_name=file_name, **job_result) the job_result looks like:

{
  "pages": [
    {
      "page": 1,
      "text": "...",
      "md": "...",
      "images": [],
      "items": [
        {
          "type": "table",
          "rows": [...],
          "md": "...",
          "isPerfectTable": true,
          "csv": "..."
        }
      ],
      "subTables": []
    }
  ],
  "job_metadata": {
    "credits_used": 0,
    "job_credits_usage": 0,
    "job_pages": 0,
    "job_auto_mode_triggered_pages": 0,
    "job_is_cache_hit": true
  }
}

Any pointers for parsing csv files?

Llama Cloud Services -> parse -> utils.py specifies csv and xlsx in the SUPPORTED_FILE_TYPES variable. I would expect csv files to be parsable

Version

llama-services 0.6.26, llama-cloud 0.1.23

Steps to Reproduce

Described above. The csv is a vlid csv as far as I can see.

Relevant Logs/Tracbacks


Originally created by @emclaughlin215 on GitHub (Jun 4, 2025). ### Bug Description Hi, I am trying to get Llama parse to parse csv and XML files but I am getting the following error, indicating that the returned object does not pass the required pydantic base model validation. ```sh File "/Users/edward/Documents/git/pythonLocal/file-text-extraction/llama-parse/./llama-parse.py", line 28, in main result = parser.parse( File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_cloud_services/parse/base.py", line 1199, in parse return asyncio_run(self.aparse(file_path, extra_info, fs=fs)) File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_index/core/async_utils.py", line 52, in asyncio_run return loop.run_until_complete(coro) File "/opt/homebrew/Cellar/python@3.10/3.10.16/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_cloud_services/parse/base.py", line 1116, in aparse return JobResult( File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/llama_cloud_services/parse/types.py", line 179, in __init__ super().__init__(job_id=job_id, file_name=file_name, **job_result) File "/Users/edward/Documents/git/pythonLocal/venv/lib/python3.10/site-packages/pydantic/main.py", line 253, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 6 validation errors for JobResult pages.0.status Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing pages.0.triggeredAutoMode Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing pages.0.parsingMode Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing pages.0.structuredData Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing pages.0.noStructuredContent Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing pages.0.noTextContent Field required [type=missing, input_value={'page': 1, 'text': 'pers...,\n'}], 'subTables': []}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing ``` My testing file is: ``` py from llama_cloud_services import LlamaParse API_KEY = {API KEY} parser = LlamaParse( api_key=API_KEY, base_url="https://api.cloud.eu.llamaindex.ai", num_workers=1, language="en" ) def main(): file_type = "csv" # sync result = parser.parse( f"./{file_name}.{file_type}", ) with open( f"./{file_type}/{file_name}-output.txt", "w", encoding="utf-8", ) as f: f.write(result.get_text_documents(split_by_page=False)[0].text_resource.text) if __name__ == "__main__": main() ``` And when i put a breakpoint in `JobResult.__init__()` before `super().__init__(job_id=job_id, file_name=file_name, **job_result)` the `job_result` looks like: ``` json { "pages": [ { "page": 1, "text": "...", "md": "...", "images": [], "items": [ { "type": "table", "rows": [...], "md": "...", "isPerfectTable": true, "csv": "..." } ], "subTables": [] } ], "job_metadata": { "credits_used": 0, "job_credits_usage": 0, "job_pages": 0, "job_auto_mode_triggered_pages": 0, "job_is_cache_hit": true } } ``` Any pointers for parsing csv files? Llama Cloud Services -> parse -> utils.py specifies csv and xlsx in the SUPPORTED_FILE_TYPES variable. I would expect csv files to be parsable ### Version llama-services 0.6.26, llama-cloud 0.1.23 ### Steps to Reproduce Described above. The csv is a vlid csv as far as I can see. ### Relevant Logs/Tracbacks ```shell ```
yindo added the bug label 2026-02-16 00:17:59 -05:00
yindo closed this issue 2026-02-16 00:17:59 -05:00
Author
Owner

@logan-markewich commented on GitHub (Jun 4, 2025):

This is a bug. Apparently need to mark those fields as optional on the pydantic class

@logan-markewich commented on GitHub (Jun 4, 2025): This is a bug. Apparently need to mark those fields as optional on the pydantic class
Author
Owner

@dosubot[bot] commented on GitHub (Jun 4, 2025):

The error you’re seeing—missing fields like status, triggeredAutoMode, parsingMode, structuredData, noStructuredContent, and noTextContent in pages[0]—indicates that the object returned by LlamaParse for your CSV file does not match the expected Pydantic schema for JobResult. This schema mismatch is likely why Pydantic raises a validation error.

Based on what’s available in the LlamaIndex repository, there is no implementation or documentation for how LlamaParse.parse() handles CSV files, nor is there any reference to the JobResult class or its schema. The integration in LlamaIndex is limited to import/export and usage documentation, and all examples focus on PDFs. The error handling and file-type-specific logic for CSVs are managed entirely in the external llama-parse package, which is not open-sourced here and thus cannot be directly inspected or debugged from this repository.

If you want to work with CSV files in LlamaIndex, you can use the built-in PagedCSVReader and wrap it with OnDemandLoaderTool for agent workflows. Here’s a basic example:

from pathlib import Path
from llama_index.readers.file import PagedCSVReader
from llama_index.core.tools.ondemand_loader_tool import OnDemandLoaderTool

csv_reader = PagedCSVReader(encoding="utf-8")
csv_tool = OnDemandLoaderTool.from_defaults(
    csv_reader,
    name="CSV Loader Tool",
    description="A tool for loading and querying data from a CSV file"
)

This approach is documented in the LlamaIndex discussions and is the recommended way to handle CSVs within the framework, especially for multi-agent workflows or when you need robust CSV parsing and querying capabilities [source].

Since the root cause of your error is a schema mismatch in the external llama-parse package, and there is no visibility into its implementation or schema expectations from this repository, using the above alternative is the best available workaround. If you need to use LlamaParse.parse() specifically for CSVs, you may need to consult the documentation or support channels for the external llama-parse package to clarify its CSV support and expected output schema.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jun 4, 2025): <!-- Answer --> The error you’re seeing—missing fields like `status`, `triggeredAutoMode`, `parsingMode`, `structuredData`, `noStructuredContent`, and `noTextContent` in `pages[0]`—indicates that the object returned by LlamaParse for your CSV file does not match the expected Pydantic schema for `JobResult`. This schema mismatch is likely why Pydantic raises a validation error. Based on what’s available in the LlamaIndex repository, there is no implementation or documentation for how `LlamaParse.parse()` handles CSV files, nor is there any reference to the `JobResult` class or its schema. The integration in LlamaIndex is limited to import/export and usage documentation, and all examples focus on PDFs. The error handling and file-type-specific logic for CSVs are managed entirely in the external `llama-parse` package, which is not open-sourced here and thus cannot be directly inspected or debugged from this repository. If you want to work with CSV files in LlamaIndex, you can use the built-in `PagedCSVReader` and wrap it with `OnDemandLoaderTool` for agent workflows. Here’s a basic example: ```python from pathlib import Path from llama_index.readers.file import PagedCSVReader from llama_index.core.tools.ondemand_loader_tool import OnDemandLoaderTool csv_reader = PagedCSVReader(encoding="utf-8") csv_tool = OnDemandLoaderTool.from_defaults( csv_reader, name="CSV Loader Tool", description="A tool for loading and querying data from a CSV file" ) ``` This approach is documented in the LlamaIndex discussions and is the recommended way to handle CSVs within the framework, especially for multi-agent workflows or when you need robust CSV parsing and querying capabilities [[source]](https://github.com/run-llama/llama_index/issues/18341). Since the root cause of your error is a schema mismatch in the external `llama-parse` package, and there is no visibility into its implementation or schema expectations from this repository, using the above alternative is the best available workaround. If you need to use `LlamaParse.parse()` specifically for CSVs, you may need to consult the documentation or support channels for the external `llama-parse` package to clarify its CSV support and expected output schema. <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c5b15f2b-25c1-4bf7-b5b1-566a05640b4d?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/run-llama/llama_index/issues/18966)
Author
Owner

@emclaughlin215 commented on GitHub (Jun 4, 2025):

Thanks for responding @logan-markewich . Do you know when a fix might be pushed for this?

Interesting that the web UI parser works for the same CSV file!

@emclaughlin215 commented on GitHub (Jun 4, 2025): Thanks for responding @logan-markewich . Do you know when a fix might be pushed for this? Interesting that the web UI parser works for the same CSV file!
Author
Owner

@emclaughlin215 commented on GitHub (Jun 4, 2025):

It's also a similar story for xmls

@emclaughlin215 commented on GitHub (Jun 4, 2025): It's also a similar story for xmls
Author
Owner

@logan-markewich commented on GitHub (Jun 4, 2025):

The web ui is not using the python sdk (its just using the actual api calls)

@logan-markewich commented on GitHub (Jun 4, 2025): The web ui is not using the python sdk (its just using the actual api calls)
Author
Owner

@logan-markewich commented on GitHub (Jun 4, 2025):

Should have a fix later today

@logan-markewich commented on GitHub (Jun 4, 2025): Should have a fix later today
Author
Owner

@emclaughlin215 commented on GitHub (Jun 5, 2025):

The web ui is not using the python sdk (its just using the actual api calls)

silly me

@emclaughlin215 commented on GitHub (Jun 5, 2025): > The web ui is not using the python sdk (its just using the actual api calls) silly me
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#485