"Failed to create file operation" -- 500 error (Assistant's API) Tier 5

Hello,

I’m running into an issue when attempting to add a file to a thread vector store run. The files are successfully saved and an openai file id is created. The issue occurs when I try to create a message with the attachment in an assistant thread.

client.beta.threads.messages.create(
                    thread_id=thread.id, role="user", 
                    content=message if message else "...", 
                    attachments=attachments
                )

This is failing and returning a 500 response

Error code: 500 - {‘error’: {‘message’: ‘Failed to create file operation.’, ‘type’: ‘server_error’, ‘param’: None, ‘code’: None}}

I have no idea whats changed as this was working before. I’m a tier 5 OpenAI business using the api for critical applications. Any help would be appreciated.

EDIT: I just confirmed that I can attach files to the thread vector store manually through the platform. It seems to mainly be failing on the API

6 Likes

+1 Here … same issue

From my Rails log:
E, [2025-02-06T14:10:42.308080 #34090] ERROR – : :x: ERROR in Providers::OpenAI::Message#create: the server responded with status 500
E, [2025-02-06T14:10:42.308178 #34090] ERROR – : :boom: ERROR in Providers::OpenAI::Message#create: Failed to create file operation.

1 Like

im seeing the error too all of a sudden today

Add a Message to the Thread

await client.beta.threads.messages.create(
    thread_id=thread.id,
    role="user",
    content=user_message,
    attachments=[
        {
            "file_id": vector_store_file_id,
            "tools": [{"type": "file_search"}, {"type": "code_interpreter"}],
        }
        for vector_store_file_id in vector_store_file_ids
    ],
)

An error occurred while processing user message: Error code: 500 - {‘error’: {‘message’: ‘Failed to create file operation.’, ‘type’: ‘server_error’, ‘param’: None, ‘code’: None}}
2025-02-05 23:07:18,288 ERROR [fastapi] - An error occurred while processing user message: Error code: 500 - {‘error’: {‘message’: ‘Failed to create file operation.’, ‘type’: ‘server_error’, ‘param’: None, ‘code’: None}}

Similar issue - uploading file fails when checking file_batch.status. Repeating it eventually successfully uploads the file. But most of the tries, it fails, whereas it previously always worked.

I am getting the same 500 error when adding a message to a thread

message = client.beta.threads.messages.create(
    thread_id=thread.id,
    role="user",
    content=prompt_text,
    attachments=[
    {
        "file_id": openai_file_id,
        "tools": [
            { "type": "file_search" },
            { "type": "code_interpreter" }
         ]
     }]
)

I am suddenly getting an error InternalServerError: Error code: 500 - {‘error’: {‘message’: ‘Failed to create file operation.’, ‘type’: ‘server_error’, ‘param’: None, ‘code’: None}}

backend-api/models?history_and_training_disabled=false

Status : 500

Version : HTTP/2

Transferred : 820 B (34 B size)

Referrer Policy : strict-origin-when-cross-origin

DNS ResolutionSystem

I assumed OpenAI was aware of this issue when they added an status update about “elevated error rates” earlier today but now they’ve marked it as resolved and i’m still seeing these errors so looks like they still might not be aware…

Seeing the same issue, even with old files (I tested to rule out issues with uploading new files). Funnily on the web interface it does work (after 2 tries).

how do we mke them aware this has broken my whole app

also running into the same problem

Same here.
problem with assistant in file upload…

error: {
message: ‘Failed to create file operation.’,
type: ‘server_error’,
param: null,
code: null
},
:frowning:

same issue, firstly it worked after a 2-3 attempts, but now I get ’ Failed to create file operation’ all the tame

Getting the same issue for calling the create message API

{
“error”: {
“message”: “Failed to create file operation.”,
“type”: “server_error”,
“param”: null,
“code”: null
}
}

Experiencing the same issues. Any workarounds/resolution for this?

Thanks for flagging this issue!
I have forwarded it to OpenAI.

5 Likes

I’m experiencing the same problem

I’m experiencing the same problem.

I’m experiencing the same problem

I’m experiencing the same problem.

Also jumping on this train, this has broken a whole operation that depends on analyzing large volumes of documents.
We are loosing money right now.

As someone else said, even existing documents are not working. In my case creating new ones results in an error:

status: 500,
  headers: {
    'alt-svc': 'h3=":443"; ma=86400',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '90dc9bfc3985fb82-POA',
    connection: 'keep-alive',
    'content-length': '135',
    'content-type': 'application/json',
    date: 'Thu, 06 Feb 2025 16:45:13 GMT',
    'openai-processing-ms': '390',
    'openai-version': '2020-10-01',
    server: 'cloudflare',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    'x-request-id': 'req_728d3ab3478953959cac9ed6af948235'
  },
  request_id: 'req_728d3ab3478953959cac9ed6af948235',
  error: {
    message: 'Failed to create file operation.',
    type: 'server_error',
    param: null,
    code: null
  },

I did some testing and found that the issue seems to be related to attachments for the file_search tool when the file doesn’t exist in the vector store.

A lot of use cases probably rely on the assumption that attachments automatically associate the file_id with the vector store behind the scenes. But now, if the file_id isn’t in the vector store, it just fails.

Reproducing the issue

The simplest way to see this in action is:

1. Upload a file

curl --location 'https://api.openai.com/v1/files' \
--header 'OpenAI-Beta: assistants=v2' \
--header 'Authorization: ••••••' \
--form 'purpose="assistants"' \
--form 'file=@"...myfile.docx"'
{
    "object": "file",
    "id": "yourfileid",
    "purpose": "assistants",
    "filename": "myfile.docx",
    "bytes": 11244,
    "created_at": 1738859492,
    "status": "processed",
    "status_details": null
}

2. Create a thread using the file

curl --location 'https://api.openai.com/v1/threads' \
--header 'OpenAI-Beta: assistants=v2' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "messages": [
        {
            "role": "user",
            "content": "What is the associated document about?",
            "attachments": [
                {
                    "file_id": "yourfileid",
                    "tools": [{ "type": "file_search" }]
                }
            ]
        }
    ]
}'
{
    "error": {
        "message": "Failed to create file operation.",
        "type": "server_error",
        "param": null,
        "code": null
    }
}

Basically, if you don’t add the file to the vector store before creating the thread (or attaching it to a message), the request fails. But if you create the vector store with the file_id first, everything works fine.

From what I understand, when you attach files as message attachments in a thread, a vector store should be automatically created and associated with the thread. If a vector store already exists for the thread, the new file should be added to it.

As stated in the docs:

“You can also attach files as Message attachments on your thread. Doing so will create another vector_store associated with the thread, or, if there is already a vector store attached to this thread, attach the new files to the existing thread vector store. When you create a Run on this thread, the file search tool will query both the vector_store from your assistant and the vector_store on the thread.”

3 Likes