[BUG] get "invalid_image" error with totaly valid images

I’ve been facing a very strange bug for weeks. I have tried everything to find the cause with no success, as it seems to be completely random. I’m sending requests in a loop, each containing an average of about ten images passed through URLs. And every few requests, I receive an “invalid_image” error.

However, when I debug this request by resending it in isolation, Vision analyzes the images that were supposed to be invalid perfectly. So nothing is due to the images, format images, resolution images, type of link, hosting links…

What’s worse, I’ve set up a retry system, which, when I receive an “invalid_image” error, resends the same request, resulting in about 95% success rate on the second attempt.

Here are all the solution ideas I have tested, which had no positive or negative impact on this bug.

  • A throttle of x seconds, to try to space out the requests.
  • Testing different quantities of image links and even a batching system to send a maximum number of images (8 by requests, for example).

Welcome to the forum.

As it’s new, I’m sure service will improve.

Anything you notice on the failing images - any similarities between them?

No, there’s no similarity between the images. The last two leads I have in mind, which I haven’t tested yet because they’re a bit complicated to implement in my case, are:

  • Downloading the images and sending them in base64.
  • Testing with images hosted on a different server, because the current server hosting the images I send is not mine and possibly there’s an anti-flood system that blocks requests coming from OpenAI after a while.

Because the only pattern I’ve identified is that when I start the script, there seem to be very few/no errors for a while, and as the requests continue, the errors become more frequent.