openai-go icon indicating copy to clipboard operation
openai-go copied to clipboard

Bug: VectorStoreFile.PollStatus fails with 400 Bad Request

Open gbrlmza opened this issue 1 month ago • 0 comments

Description

The VectorStoreFile.PollStatus method is calling the underlying Get method with parameters in the wrong order, causing API requests to fail with 400 Bad Request errors.

Current Behavior

When calling PollStatus, the internal Get call uses swapped parameters (fileID, vectorStoreID instead of vectorStoreID, fileID), which generates an incorrect URL path like /vector_stores/{fileID}/files/{vectorStoreID} instead of the correct /vector_stores/{vectorStoreID}/files/{fileID}.

Expected Behavior

The Get method should be called with parameters in the correct order to generate the proper API endpoint path.

Steps to Reproduce

  1. Call VectorStoreFile.PollStatus with a valid vector store ID and file ID
  2. The method will fail with a 400 Bad Request error due to the malformed URL path

Impact

Any code using PollStatus(NewAndPoll and UploadAndPoll) will fail, as these methods cannot successfully poll the file status.

Fix

Swap the parameter order in the Get call within PollStatus from r.Get(ctx, fileID, vectorStoreID, opts...) to r.Get(ctx, vectorStoreID, fileID, opts...) as proposed in #537 that also includes a unit test

gbrlmza avatar Oct 14 '25 18:10 gbrlmza