Cannot process same PDF file twice #199

Closed
opened 2026-02-16 00:17:07 -05:00 by yindo · 8 comments
Owner

Originally created by @jaikb on GitHub (Jul 22, 2024).

We're facing a big issue right now where we can't process the same PDF twice. The first time I try to parse it, it works fine then the second time I'm getting this error:

[{'detail': 'Result not found. Check job status to see if it has completed.', 'job_id': '66cf8baf-923d-43bb-8d7f-d3f95a89a79c', 'file_path': 'pdf-document.pdf'}]
Originally created by @jaikb on GitHub (Jul 22, 2024). We're facing a big issue right now where we can't process the same PDF twice. The first time I try to parse it, it works fine then the second time I'm getting this error: ``` [{'detail': 'Result not found. Check job status to see if it has completed.', 'job_id': '66cf8baf-923d-43bb-8d7f-d3f95a89a79c', 'file_path': 'pdf-document.pdf'}] ```
yindo added the bug label 2026-02-16 00:17:07 -05:00
yindo closed this issue 2026-02-16 00:17:07 -05:00
Author
Owner

@tkcoding commented on GitHub (Jul 23, 2024):

solution and explanation is here : https://github.com/run-llama/llama_parse/issues/278

@tkcoding commented on GitHub (Jul 23, 2024): solution and explanation is here : https://github.com/run-llama/llama_parse/issues/278
Author
Owner

@jaikb commented on GitHub (Jul 23, 2024):

@tkcoding I saw that solution and adding the invalidate_cache = True to my parser object did not fix the code. Reference below the code I am using:

parser_gpt4o = LlamaParse(
        api_key=environ.get("LLAMA_CLOUD_API_KEY"),
        result_type="markdown",
        verbose=True,
        language="en",
        gpt4o_mode=True,
        gpt4o_api_key=environ.get("LLAMAPARSE_OPENAI_API_KEY"),
        ignore_errors=False,
        invalidate_cache=True,
    )

document = parser_gpt4o.get_json_result(file_path)
@jaikb commented on GitHub (Jul 23, 2024): @tkcoding I saw that solution and adding the `invalidate_cache = True` to my parser object did not fix the code. Reference below the code I am using: ``` parser_gpt4o = LlamaParse( api_key=environ.get("LLAMA_CLOUD_API_KEY"), result_type="markdown", verbose=True, language="en", gpt4o_mode=True, gpt4o_api_key=environ.get("LLAMAPARSE_OPENAI_API_KEY"), ignore_errors=False, invalidate_cache=True, ) document = parser_gpt4o.get_json_result(file_path) ```
Author
Owner

@adreichert commented on GitHub (Jul 23, 2024):

I'm able to cause the issue. Below is the full code. While the jobs are marked as SUCCESS, I'm unable to download the results.

Parse

Python Code

from os import environ
import sys

file_path = sys.argv[1]
parser_gpt4o = LlamaParse(
    api_key=environ["LLAMA_CLOUD_API_KEY"],
    verbose=True,
    gpt4o_mode=True,
    gpt4o_api_key=environ["LLAMAPARSE_OPENAI_API_KEY"],
    ignore_errors=False,
    invalidate_cache=True,
    do_not_cache=True,
)
try:
    print("Markdown")
    print(parser_gpt4o.load_data(file_path))
except KeyError as e:
    print("Error: ", e)
print("JSON")
print(parser_gpt4o.get_json_result(file_path))

Shell Output

Markdown
Started parsing the file under job_id a45e687b-7901-43ec-ab79-de9407e977c8
Error while parsing the file '/Users/areichert/Desktop/pronto-forms.pdf': 'text'
Error:  'text'
JSON
Started parsing the file under job_id 78df4a75-bfaf-47c7-a347-05f6db0a8ec5
[{'detail': 'Result not found. Check job status to see if it has completed.', 'job_id': '78df4a75-bfaf-47c7-a347-05f6db0a8ec5', 'file_path': '/Users/areichert/Desktop/pronto-forms.pdf'}]

Job Marked As Success But Cannot Download.

curl -X 'GET' \
  'https://api.cloud.llamaindex.ai/api/parsing/job/78df4a75-bfaf-47c7-a347-05f6db0a8ec5' \
  -H 'accept: application/json' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
echo
curl -X 'GET' \
  'https://api.cloud.llamaindex.ai/api/parsing/job/78df4a75-bfaf-47c7-a347-05f6db0a8ec5/result/markdown' \
  -H 'accept: application/json' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
{"id":"78df4a75-bfaf-47c7-a347-05f6db0a8ec5","status":"SUCCESS"}
{"detail":"Result not found. Check job status to see if it has completed."}%      
@adreichert commented on GitHub (Jul 23, 2024): I'm able to cause the issue. Below is the full code. While the jobs are marked as `SUCCESS`, I'm unable to download the results. # Parse ## Python Code ```from llama_parse import LlamaParse from os import environ import sys file_path = sys.argv[1] parser_gpt4o = LlamaParse( api_key=environ["LLAMA_CLOUD_API_KEY"], verbose=True, gpt4o_mode=True, gpt4o_api_key=environ["LLAMAPARSE_OPENAI_API_KEY"], ignore_errors=False, invalidate_cache=True, do_not_cache=True, ) try: print("Markdown") print(parser_gpt4o.load_data(file_path)) except KeyError as e: print("Error: ", e) print("JSON") print(parser_gpt4o.get_json_result(file_path)) ``` ## Shell Output ``` Markdown Started parsing the file under job_id a45e687b-7901-43ec-ab79-de9407e977c8 Error while parsing the file '/Users/areichert/Desktop/pronto-forms.pdf': 'text' Error: 'text' JSON Started parsing the file under job_id 78df4a75-bfaf-47c7-a347-05f6db0a8ec5 [{'detail': 'Result not found. Check job status to see if it has completed.', 'job_id': '78df4a75-bfaf-47c7-a347-05f6db0a8ec5', 'file_path': '/Users/areichert/Desktop/pronto-forms.pdf'}] ``` # Job Marked As Success But Cannot Download. ``` curl -X 'GET' \ 'https://api.cloud.llamaindex.ai/api/parsing/job/78df4a75-bfaf-47c7-a347-05f6db0a8ec5' \ -H 'accept: application/json' \ -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" echo curl -X 'GET' \ 'https://api.cloud.llamaindex.ai/api/parsing/job/78df4a75-bfaf-47c7-a347-05f6db0a8ec5/result/markdown' \ -H 'accept: application/json' \ -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" ``` ``` {"id":"78df4a75-bfaf-47c7-a347-05f6db0a8ec5","status":"SUCCESS"} {"detail":"Result not found. Check job status to see if it has completed."}% ```
Author
Owner

@emorling commented on GitHub (Jul 24, 2024):

I can confirm this, I have same issue.

@emorling commented on GitHub (Jul 24, 2024): I can confirm this, I have same issue.
Author
Owner

@tkcoding commented on GitHub (Jul 24, 2024):

@tkcoding I saw that solution and adding the invalidate_cache = True to my parser object did not fix the code. Reference below the code I am using:

parser_gpt4o = LlamaParse(
        api_key=environ.get("LLAMA_CLOUD_API_KEY"),
        result_type="markdown",
        verbose=True,
        language="en",
        gpt4o_mode=True,
        gpt4o_api_key=environ.get("LLAMAPARSE_OPENAI_API_KEY"),
        ignore_errors=False,
        invalidate_cache=True,
    )

document = parser_gpt4o.get_json_result(file_path)

I couldn't replicate this issue by using the same setup you have there, I tried to run the document three times and it went through OK.

Did you try other document ?

@tkcoding commented on GitHub (Jul 24, 2024): > @tkcoding I saw that solution and adding the `invalidate_cache = True` to my parser object did not fix the code. Reference below the code I am using: > > ``` > parser_gpt4o = LlamaParse( > api_key=environ.get("LLAMA_CLOUD_API_KEY"), > result_type="markdown", > verbose=True, > language="en", > gpt4o_mode=True, > gpt4o_api_key=environ.get("LLAMAPARSE_OPENAI_API_KEY"), > ignore_errors=False, > invalidate_cache=True, > ) > > document = parser_gpt4o.get_json_result(file_path) > ``` I couldn't replicate this issue by using the same setup you have there, I tried to run the document three times and it went through OK. Did you try other document ?
Author
Owner

@emorling commented on GitHub (Jul 24, 2024):

Did you try other document ?

I found it reproducable with any .txt document

@emorling commented on GitHub (Jul 24, 2024): > Did you try other document ? I found it reproducable with any .txt document
Author
Owner

@tkcoding commented on GitHub (Jul 24, 2024):

@jaikb @emorling @adreichert
I think I figured out what happened .
TL;DR
Basically it failed at sending the document to gpt4o which is kind of "deprecated" by now.

The old 'gpt4o_mode=True' doesnt work as expected anymore. Dev team have introduced new args which should be working for your test case .

I tested out on a .txt and it threw connection exception when processed second time, after I change to vendor_multimodel args as below then it's working now.

LlamaParse(
            verbose=True,
            ignore_errors=False,
            invalidate_cache=True,
            do_not_cache=True,
            vendor_multimodal_api_key=environ["LLAMAPARSE_OPENAI_API_KEY"],
            vendor_multimodal_model_name = 'gpt4o_mini',
            use_vendor_multimodal_model=True
        )
@tkcoding commented on GitHub (Jul 24, 2024): @jaikb @emorling @adreichert I think I figured out what happened . TL;DR Basically it failed at sending the document to gpt4o which is kind of "deprecated" by now. The old 'gpt4o_mode=True' doesnt work as expected anymore. Dev team have introduced new args which should be working for your test case . I tested out on a .txt and it threw connection exception when processed second time, after I change to vendor_multimodel args as below then it's working now. ``` LlamaParse( verbose=True, ignore_errors=False, invalidate_cache=True, do_not_cache=True, vendor_multimodal_api_key=environ["LLAMAPARSE_OPENAI_API_KEY"], vendor_multimodal_model_name = 'gpt4o_mini', use_vendor_multimodal_model=True )
Author
Owner

@hexapode commented on GitHub (Jul 26, 2024):

This is now solved in production without the need to invalid_cache=True

@hexapode commented on GitHub (Jul 26, 2024): This is now solved in production without the need to `invalid_cache=True`
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#199