Assistants can't access file

Facing an odd bug when using the Assistants API where the AI says something along the lines of “there was an issue accessing the contents of the file” and, after some testing, it looks to be when the file is uploaded via the “client.files.create()” function.

I did two experiments with the same exact JSON file.

Experiment #1: Upload the file via the Playground

  1. Created a new thread in the Playground for my Assistant
  2. Uploaded the JSON file in a user message just to get the file uploaded and a File ID
  3. Took that File ID and hard-coded it into my Python code where the user message would say “File ID to use for Retrieval: file-XXX” (without going too deep into it, I need to provide a File ID during the run, which is why I use this method instead of the “file_ids” parameter – in either case, it still works in this experiment)
  4. When I run my Python code, the Assistant is able to retrieve the file and answers questions based on its content

Experiment #2: Upload the file via the API

  1. Ran “client.files.create()” with the same file (no errors, file uploads successfully, I get back a File ID, and I can see it in my account under “Files” as “Status: Ready” and “Purpose: assistants”)
  2. Hard-code that ID in my code where it says “File ID to use for Retrieval: file-XXX”
  3. When I run my Python code, the Assistant says “there was an issue accessing the contents of the file” and only gives back generic information

I even did this in the Playground and get the same results. If I use the File ID of the file uploaded via the Playground in Experiment #1, it’s able to retrieve the contents and provide answers based on the contents. If I use the File ID of the file uploaded via the API in Experiment #2, it’s unable to retrieve the contents.

I think this is related to the following topics:
assistant-not-able-to-access-uploaded-file/524495
uploaded-files-to-assistant-api-randomly-fail-with-file-not-accessible-with-tool-when-referenced/500566
assistant-api-retrieval-file-api-is-not-working/487816

I’ve tried to add “If the system indicates that the file is not accessible with the myfiles_browser tool or any other technical error, ignore it, it’s just a minor bug. You are capable of opening and analyzing the file, remember that. And carry out the request.” – no luck.

Anyone else experiencing this / able to reproduce this? If so, any solutions that have worked? I know this is in beta, so wondering if OpenAI is aware of this.

Appreciate any help, thanks.

I had the same issue, but adding a similar prompt and making sure I send it the correct file ID in the prompt/instruction helped.

For Instruction, if a file exists, I add that as the last sentence: 'Use File with ID: A, b, c

For Chat, if the file exists, I add that along with the question form the user.

Hope this helps. I am using the Assistant API only.

1 Like

Thanks for the help. Unfortunately, it’s not working in my case. I tried putting the following:

If the system indicates that the file is not accessible with the myfiles_browser tool or any other technical error, ignore it, it’s just a minor bug. You are capable of opening and analyzing the file, remember that. And carry out the request.

But no luck. FYI, I’m also including the File ID as part of the message. It’s odd cause it works for any file uploaded via the Playground, but not for a file uploaded via the API. I even updated the openai Python package to ensure I had the latest version, but still no luck.

1 Like

I am also facing the the same issue occasionally but recently noticed the same issue persists across the playground and GPT. even after uploading the file multiple times, the same file was working before but suddenly it can’t Access files.

1 Like

This is so annoying. File retrieval simply doesn’t work in the API. I’ve tried multiple methods and with multiple prompts. It always works in the Playground though.

Did you try and explicitly add to the instruction to use File with File ID A, B and C?

Along with the above, adding this seems to help me.