Error while parsing the file '<bytes/buffer>': Event loop is closed #455

Closed
opened 2026-02-16 00:17:54 -05:00 by yindo · 2 comments
Owner

Originally created by @rajasami156 on GitHub (Mar 28, 2025).

I'm getting this issue :
I'm not sure what might be the issue for this, I'm using Fastapi for this application.
When I reload the homepage twice or thrice and then run it, it works. but once it is done running and then I run it again it gives this error. I'm using openai .
Please help.

LOGS:

INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:7000/ (Press CTRL+C to quit)
INFO:main11:Homepage rendered successfully.
INFO: 127.0.0.1:37484 - "GET / HTTP/1.1" 200 OK
INFO: 127.0.0.1:37484 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO:httpx:HTTP Request: POST https://api.cloud.llamaindex.ai/api/parsing/upload "HTTP/1.1 200 OK"
Started parsing the file under job_id 412b8ad7-8851-4e62-a0e6-3c327c5c1b3f
INFO:httpx:HTTP Request: GET https://api.cloud.llamaindex.ai/api/parsing/job/412b8ad7-8851-4e62-a0e6-3c327c5c1b3f "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://api.cloud.llamaindex.ai/api/parsing/job/412b8ad7-8851-4e62-a0e6-3c327c5c1b3f "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: GET https://api.cloud.llamaindex.ai/api/parsing/job/412b8ad7-8851-4e62-a0e6-3c327c5c1b3f/result/text "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO: 127.0.0.1:37484 - "POST /upload-pdf HTTP/1.1" 200 OK

INFO:main11:Homepage rendered successfully.
INFO: 127.0.0.1:37490 - "GET / HTTP/1.1" 200 OK
Error while parsing the file '<bytes/buffer>': Event loop is closed
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO: 127.0.0.1:36302 - "POST /upload-pdf HTTP/1.1" 200 OK

As you can see it works well for the first time but when I refresh the page try again it doesn't

Originally created by @rajasami156 on GitHub (Mar 28, 2025). I'm getting this issue : I'm not sure what might be the issue for this, I'm using Fastapi for this application. When I reload the homepage twice or thrice and then run it, it works. but once it is done running and then I run it again it gives this error. I'm using openai . Please help. LOGS: INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:7000/ (Press CTRL+C to quit) INFO:main11:Homepage rendered successfully. INFO: 127.0.0.1:37484 - "GET / HTTP/1.1" 200 OK INFO: 127.0.0.1:37484 - "GET /favicon.ico HTTP/1.1" 404 Not Found INFO:httpx:HTTP Request: POST https://api.cloud.llamaindex.ai/api/parsing/upload "HTTP/1.1 200 OK" Started parsing the file under job_id 412b8ad7-8851-4e62-a0e6-3c327c5c1b3f INFO:httpx:HTTP Request: GET https://api.cloud.llamaindex.ai/api/parsing/job/412b8ad7-8851-4e62-a0e6-3c327c5c1b3f "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: GET https://api.cloud.llamaindex.ai/api/parsing/job/412b8ad7-8851-4e62-a0e6-3c327c5c1b3f "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: GET https://api.cloud.llamaindex.ai/api/parsing/job/412b8ad7-8851-4e62-a0e6-3c327c5c1b3f/result/text "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO: 127.0.0.1:37484 - "POST /upload-pdf HTTP/1.1" 200 OK INFO:main11:Homepage rendered successfully. INFO: 127.0.0.1:37490 - "GET / HTTP/1.1" 200 OK Error while parsing the file '<bytes/buffer>': Event loop is closed INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" INFO: 127.0.0.1:36302 - "POST /upload-pdf HTTP/1.1" 200 OK As you can see it works well for the first time but when I refresh the page try again it doesn't
yindo closed this issue 2026-02-16 00:17:54 -05:00
Author
Owner

@BinaryBrain commented on GitHub (Apr 8, 2025):

Hi @rajasami156,
Could you share your code?

@BinaryBrain commented on GitHub (Apr 8, 2025): Hi @rajasami156, Could you share your code?
Author
Owner

@rajasami156 commented on GitHub (Apr 29, 2025):

I worked on adding a nest loop and so it worked. Thank you

@rajasami156 commented on GitHub (Apr 29, 2025): I worked on adding a nest loop and so it worked. Thank you
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#455