Files Successfully Uploaded but Failing to Assign to Vector Store

Hello Community,

I’m working on an application where users can upload files to OpenAI’s storage. After uploading, the files should be automatically assigned to the vector store for an assistant I’ve created. While the upload process works fine, I’m encountering an issue when trying to assign the files to the vector store.

Below is a screenshot showing that the files were uploaded successfully, followed by a screenshot where the assignment to the vector store failed.

The file sizes are under 5MB, so I don’t believe that’s the cause. Initially, I suspected it might be a network-related problem, but now I’m unsure.

Any advice or insights on resolving this would be greatly appreciated!

Hi, is this still a problem?

Hey @Foxalabs
Yes, still facing the issue.
Any pointers?

I raised the upload issue with OpenAI last week, the issue is this is mostly done by a Microsoft service called AI search, and it seems it’s that part that is having issues. I will raise it again.

Sure thing. Please post the issue link here for reference.

There is no external link for this, it’s something I noticed happening, so I raised at one of our regular meetings.

Got you. Keep me posted with your team findings.
Appreciate it.

What tool are you using in your Assistant? Is it File Search or Code Interpreter?

I am using File Search for an assistant.

1 Like

I am getting this issue too, but can’t tell if it’s an issue with my formatting. I am uploading JSON file. It uploads just fine through API but we get a 400 error when trying to attach the files to a vector store.

That’s interesting. Because while debugging, in my code I get response 200. But it shows status ‘Failed’ on website under my account.
I used create vector store file api for attaching file I uploaded to vector store of an assistant.

Below is the code chunk I wrote,

# Assign uploaded files to the assistant's vector store
def assign_file_to_vector_store(file_id):
    vector_store_url = f"https://api.openai.com/v1/vector_stores/{VECTOR_STORE_ID}/files"
    
    assistant_upload_headers = {
        "Authorization": f"Bearer {OPENAI_API_KEY}",
        "Content-Type": "application/json",
        "OpenAI-Beta": "assistants=v2"
    }
    
    data = {
        "file_id": file_id
    }
    
    response = requests.post(vector_store_url, headers=assistant_upload_headers, json=data)
    
    if response.status_code == 200:
        return response.json()
    else:
        raise Exception(f"Error assigning file to vector store: {response.text}")

Have you found a solution to this? I am running into the exact same issue. I will look into turning the pdf into json. My pdfs are images of text, somtimes they work, sometimes they dont, but there seems to be consistency with files.

If the file failed once, it will always fail, but if it works once, it will always work.

I’ve already encountered this roadblock.

I’ve been researching related topics on the OpenAI community and other resources but haven’t found a definitive solution yet. However, I did discover a workaround that’s been working for me temporarily.

While debugging, I noticed that when uploading multiple files at once, they fail to be assigned to the vector store. To address this, I modified my approach to upload files one by one, with a time delay between each upload. After doing this, the files are successfully assigned to the assistant’s vector store.

This isn’t a long-term fix, so I’m hoping to find a more permanent solution soon.