Skip to content

Bug client when retrieving a canceled file content #2611

@dat-lequoc

Description

@dat-lequoc

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "openai==1.106.1",
# ]
# ///
from openai import OpenAI
client = OpenAI()

file_response = client.files.content("file-1utDoqUx3phTPZrc7tD...")
print(file_response.text)

got this :

uv run openai_batch_example/retrieve_results.py 
Uninstalled 1 package in 21ms
Installed 1 package in 12ms
Traceback (most recent call last):
  File "/lambda/nfs/embeddings/datagen/openai_batch_example/retrieve_results.py", line 10, in <module>
    file_response = client.files.content("file-1utDoqUx3phTPZrc7tDif4")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.cache/uv/environments-v2/retrieve-results-cf324f1aa84c201e/lib/python3.12/site-packages/openai/resources/files.py", line 286, in content
    return self._get(
           ^^^^^^^^^^
  File "/home/ubuntu/.cache/uv/environments-v2/retrieve-results-cf324f1aa84c201e/lib/python3.12/site-packages/openai/_base_client.py", line 1205, in get
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.cache/uv/environments-v2/retrieve-results-cf324f1aa84c201e/lib/python3.12/site-packages/openai/_base_client.py", line 1047, in request
    raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: <html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>

To Reproduce

  1. submit a batch
  2. Cancel it
  3. Get the output id file => bugging. It's supposed to retrieve processed records

Code snippets

OS

linux

Python version

v3.12

Library version

1.106.1 ; 1.105 or 1.100 failed as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions