Wrong "The image data you provided does not represent a valid image" Error when sending only JPG image links

I’m seeing an occasional error from the chatGPT API returning that “The image data you provided does not represent a valid image. Please check your input and try again with one of the supported image formats: [‘image/jpeg’, ‘image/png’, ‘image/gif’, ‘image/webp’].” However I’m only sending image links to jpeg files. The images are small in size mostly below 100KB and we only send up to 5 images total in the request. This error message seems to be incorrect.

Something I did notice is we only seem to get this error when sending multiple image links, where at least 2 of them are duplicates (same link exists in 2 different image_input objects). See example request below(links 1 & 3 are the same). Is this expected behavior or is this a bug?

Sample request:

{
    "model": "gpt-4.1-mini",
    "temperature": 0.1,
    "max_output_tokens": 500,
    "instructions": "You are an expert at classifying products into which category they fit best. Use the product title, description, features, attributes, and sample images of the product to make your decision. Do not add new special characters. Assign a confidence score between 0-10 on your choice, 10 if you are very confident in your decision and 0 if you are not confident.",
    "input": [
        {
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": "Please classify the following product into one of the options in the available-categories list provided. Your answer should exactly match one of the options in the available-categories list. The product-title is [PAW Patrol: The Movie, Marshall Collectible Figure] The product-description is [...]"
                },
                {
                    "type": "input_image",
                    "image_url": "http://imageSource.com/SOURCE/ec0df9959d504d15ad79a68245348f41"
                },
                {
                    "type": "input_image",
                    "image_url": "http://imageSource.com/SOURCE/13a5d7803d234103b73cc580ef4a1e62"
                },
                {
                    "type": "input_image",
                    "image_url": "http://imageSource.com/SOURCE/ec0df9959d504d15ad79a68245348f41"
                }
            ]
        }
    ],
    "text": {
        "format": {
            "type": "json_schema",
            "name": "CategoryResponse",
            "schema": {
                "type": "object",
                "properties": {
                    "confidence": {
                        "type": "integer"
                    },
                    "choice": {
                        "type": "string"
                    }
                },
                "required": [
                    "choice",
                    "confidence"
                ],
                "additionalProperties": false
            },
            "strict": false
        }
    }
}
3 Likes

Think it’s a bug. I’ve also had the same error accessing o4-mini via a unified API and submitting only one image. Waited a few minutes and it worked.

1 Like

Had this issue persisting again for longer. FYI, got it working by reformatting the image using Pillow in Python:

from PIL import Image
img = Image.open(“old.jpg”).convert(“RGB”)
img.save(“new.jpg”, “JPEG”, quality=95)