A user uploaded a video to my app, which I then uploaded to the Gemini Files API using the TS SDK.
Since then, iterating through ai.files.list() eventually fails with:
500 INTERNAL: Failed to convert server response to JSON
At the time, I was focused on fixing my app. I removed all list operations and changed the application to get known files directly, re-uploading them
when get fails. This workaround resolved the immediate issue, but I did not record which file originally caused the failure.
Later, I investigated by calling the Files API manually. With pageSize=100, the first four pages succeeded, but the fifth page failed. I progressively reduced
the page size until I could retrieve 479 files. Requesting the next file with pageSize=1 still returned the same 500 error.
This suggests that one file may be corrupted or cannot be serialized, causing the entire listing operation to fail. Because the API returns 500 before returning
that file’s files/{id}, I cannot identify or delete it.
This is only a guess. I will get the answer tomorrow as the corrupted file will be automatically delete tomorrow.