Assistant API: Files Not Accessible in Messages Despite Successful Upload

Hey everyone! :wave:

I’m running into an issue while using the Assistant API. I’m creating a thread and attaching files using file_search. Everything seems fine during the file upload (files get 200 OK responses), and the run completes with a “completed” status. But when I retrieve the messages, the assistant says it can’t access the files.

Here’s an example of the error message I get:

I am currently unable to access the files provided. Please ensure that the files have been correctly uploaded and available for me to process.

How I’m attaching files:
I’m trying to send files in separate categories so the assistant can distinguish between them. Here’s how I structure the messages in the thread:

thread = client.beta.threads.create(
    messages=[
        {
            "role": "user",
            "content": "Files in category 1.",
            "attachments": [
                {
                    "file_id": file_id,
                    "tools": [{"type": "file_search"}]
                } for file_id in category_1_file_ids
            ],
        },
        {
            "role": "user",
            "content": "Files in category 2.",
            "attachments": [
                {
                    "file_id": file_id,
                    "tools": [{"type": "file_search"}]
                } for file_id in category_2_file_ids
            ],
        },
        {
            "role": "user",
            "content": "Files in category 3.",
            "attachments": [
                {
                    "file_id": file_id,
                    "tools": [{"type": "file_search"}]
                } for file_id in category_3_file_ids
            ],
        }
    ]
)

What’s happening:

  • Files are uploaded using client.files.create with purpose='assistants'.
  • The thread is created successfully, and the run completes with “completed” status.
  • However, when I retrieve messages, the assistant says it can’t access the files.

What I’ve tried:

  • Confirmed that files have valid extensions (e.g., .txt, .pdf).
  • Ensured files are uploaded successfully and have status processed.
  • Waited for the run to complete before retrieving messages.
  • Double-checked that file IDs match the uploaded files.

Still no luck! :face_with_diagonal_mouth: Any ideas on what might be causing this? Appreciate your help! :pray:

Some additional responses I got from thread messages:

"It seems there was an error in querying the files. Let’s proceed by reviewing the files individually to assess…

"Unfortunately, due to a system error, I am currently unable to access the files. To proceed, please re-upload them or provide any essential details within text format here for me to review and provide the criteria effectively. Alternatively, I can offer manual guidance…

"I apologize for the inconvenience earlier. There seems to be a technical issue with accessing the files using the commands. Let me manually verify and access the files to continue the process for the process. I’ll investigate and extract the relevant necessary files once more effectively

"There seems to be an ongoing issue with accessing the files. Let me attempt another method to access and process these files appropriately. I’ll try to call the files again using the correct input method for this system

"It seems there is still a challenge accessing the files. Let me manually process this with the correct tool command to ensure I can review and evaluate the files appropriately. Let me try it again using the right protocol for file access.

“It seems there was an issue with retrieving the files. Let’s attempt a correct search to open the provided files and complete the process. Let me try that again.”

"I apologize for the confusion. Let me retrieve the files for proper evaluation using the correct method.

"It seems there is an issue with accessing the files normally expected for processing. Please manually provide the content or main aspects of the…

1 Like

I am experiencing exactly the same issue. Is there no one at OpenAI who can explain this problem?

I also have the same issue, doing the exact same but kinda 50/50 the vector store / file search is accessible by the LLM. Kinda frustrating because I don’t know what to improve. The files I’m using are not even huge, about 1mb of text messages.

I’m having the same problem, all day long.