
When MIME Sniffing Breaks Your AI Agents Eyes
Your user sends a screenshot. Your agent responds as if nothing was attached. No error message. No retry. Just... blindness. Welcome to #51881 , where a MIME sniffing library quietly breaks image processing for an entire class of PNG files. The Bug When OpenClaw processes an image attachment, it runs fileTypeFromBuffer to detect the real MIME type. The idea is sound: dont trust the client-provided MIME, verify it. The problem? Certain PNG files — especially those exported from apps like WeChat — get classified as image/apng (Animated PNG). APNG is technically a superset of PNG, so the detection isnt wrong. But Claude API only accepts four image MIME types: image/jpeg , image/png , image/gif , image/webp . APNG is not on the list. HTTP 400. The Silent Part The gateway always prefers the sniffed MIME over the provided one: images . push ({ type : " image " , data : b64 , mimeType : sniffedMime ?? providedMime ?? mime // sniffed always wins }); The API rejects it. If fallback is configure
Continue reading on Dev.to Webdev
Opens in a new tab

![[Learning notes and hw] getting started with R-cnn: Manually implementing Intersection over Union (IoU)](/_next/image?url=https%3A%2F%2Fmedia2.dev.to%2Fdynamic%2Fimage%2Fwidth%3D800%252Cheight%3D%252Cfit%3Dscale-down%252Cgravity%3Dauto%252Cformat%3Dauto%2Fhttps%253A%252F%252Fdev-to-uploads.s3.amazonaws.com%252Fuploads%252Farticles%252Favit2emoxc0g68e5ltqj.jpg&w=1200&q=75)

