Animated GIF under 3 MB will upload but can't attach to tweet


I am wondering if the documented 3MB limit for animated GIFs is correct.
To reproduce, try with this GIF:

It is 2.7 MB in size, consisting of 2 frames at resolution 2000x1333.
The media upload seems to work.
On the subsequent call to we get {"errors":[{"message":"Internal error","code":131}]}

If I try the same GIF in the twitter UI, the result is similar - upload seems to work, but when I click “Tweet”, I get “Internal server error”. Screenshot:


Yes, the documented limit is correct. However, the POST media/upload method also creates media for other APIs (such as the Ads API), so it will not verify every limit in the first place.

Instead, if you want to avoid waiting until calling POST statuses/update to get the error, your code is supposed to verify the file size before uploading it.


Thanks @jubionet but if you check the image I am talking about, it is well under 3 MB. That’s the issue.
Why can’t this GIF be attached to a tweet? It doesn’t violate any documented limits. We do validate image sizes on the client side before uploading. We often get failures anyway, such as this one.


Now that you say it, obviously you’re right. Let’s see what Staff has to say about it.



Hmm, interesting. I’m wondering if we have dimension limitations for GIFs that is not publicly documented. I cannot find such limits myself, so I have inquired with the Media Platform team for GIF specifications and troubleshooting this specific case. This is being tracked internally as PREL-17544.


@jbulava I should mention this particular image is something of an outlier, being only 2 frames of relatively high resolution. I’ve also seen the same failure with images that have many frames at lower resolution.
For example, this one is 512 kb, 1280x720 pixels, but has 210 frames:


To clarify the issue with the 210-frame GIF, you are saying you occasionally see an error when uploading the image or when attempting to Tweet with its media ID? I was able to upload and Tweet this GIF with twurl, however, I have heard of occasional issues during the upload process for GIFs with a large number of frames. That is an issue currently being addressed.


@jbulava as described above, the issue is that upload succeeds, but attaching to tweet consistently fails. Thanks.


Another GIF that won’t work, “Internal server error”

{message: "Internal error", code: 131} code : 131 message : "Internal error"