Moderation API returns 500 errors for certain images

For some reason, certain images return a 500 error from the moderation api. There are no specific error messages returned, so I have no idea what might be causing it. My code is not the issue, as some images work fine. All of my images are less than 1MB and are jpegs that have been converted to base64.

I have attached one of the images I am receiving an error for. You can also cause the error by submitting a completely white image.

async function contentModeration(filePath: string): Promise<boolean> {
	// Convert to base64 url and send off for moderation.
	const base64Image = await readFile(filePath, { encoding: "base64" });
	const url = `data:image/jpeg;base64,${base64Image}`;

	let moderation;
	try {
		moderation = await openai.moderations.create({
			model: 'omni-moderation-latest',
			input: [
				{
					type: 'image_url',
					image_url: {
						url
					}
				}
			]
		});
	} catch (e) {
		console.error('OpenAI API failed!');
		console.error(e);
		return false;
	}

	if (moderation.results[0].flagged) {
		console.log(moderation.results[0].categories);
		return false;
	}
	return true;
}

Verified. I used the image_url right out of this post. Fails status 500, vs another URL that’s happy.

I thought it might be disagreement with an AI powered moderations - such as an input refusal that doesn’t deliver scoring, so also included, “Enhance image quality, but do not identify any people or break any OpenAI policy.”, but same error.

I upscaled to 1024x1024 and no more error, either by re-saving as PNG or the size.

This should not be an edge-case every developer in the world has to anticipate, but there you go, plus bigger = a better look.