500 error when referencing newly added file

Hi, I’m getting an error most of the times when first uploading a file using the files api and then referencing that file in the responses api. With a retry it doesn’t fail anymore. This started happening a few days ago, before this error didn’t occur.

The error is “Error code: 500 - {‘error’: {‘message’: ‘Unknown error while validating file ownership.’, ‘type’: ‘server_error’, ‘param’: None, ‘code’: None}}”

My upload code is

path_file_name = '/home/some_path/file.pdf'
client.files.create(
            file=open(path_file_name, 'rb'), purpose="user_data"
        )

llm call

uploaded_file_id ='file_aabbccsomething'
content = [{"type": "input_text", "text": user_prompt}]

if uploaded_file_id is not None:

  content.append({"type" : "input_file", "file_id": uploaded_file_id})

response = await client.responses.create(

  model=model_name,

  text={

    "format": {

      "type": "json_schema",

      "name": "output_response",

      "strict": True,

      "schema": response_schema

    }

 },

 store=False,

 max_output_tokens=max_tokens,

 input=[

   {

      "role": "developer",

      "content": system_prompt

   },

  {

    "role": "user",

    "content": content

  }]
)

What could be the cause here and is there something to do to prevent it?

I don’t think its affecting only new files.

Since the AWS outage (just an anecdote) a few days ago, I’ve been getting those errors randomly when using Responses API in conjunction with file_id’s.

What is interesting that the amount of failures changes in time? Yesterday I got error 500 2 times out of 10, today it is 9/10.

I started encountering this issue today. As a temporary workaround, retrying the same request usually succeeds on the second attempt.