Getting "media parameter is invalid" after successfully uploading media



We’ve been getting several errors after posting status updates with media attached.

It seems the error occurs for images that are larger than 3Mb (the limit reported by /help/configuration.json), despite the fact that the image uploads successfully:

  1. Upload an image:

$ twurl -H -X POST “/1.1/media/upload.json” --file “image.jpg” --base64 --file-field “media_data”

  1. Post a tweet with the media attached:

$ twurl -X POST “/1.1/statuses/update.json?status=blarg&media_ids=677947581679296512”
{“errors”:[{“code”:44,“message”:“media parameter is invalid.”}]}

Can someone provide insight into what caused this error?

If this error is truly caused by the image being too large, shouldn’t it be reported during the post to /1.1/media/upload.json?

Thanks for any information you can provide, this one has been truly difficult to debug on our side :smile:


Also wanted to note that the official API docs say the limit is 5MB, which we assumed was correct until Brian thought to check the configuration.json endpoint :grimacing:
so if the limit is really 3MB, then part of the problem is incorrect documentation.


Got a reply privately:

The media/upload endpoint’s upload limit, which is used for Tweet
photos, profile photos, etc, is indeed 5MB. However, a photo that is
attached to a Tweet cannot be larger than 3MB.
That’s why you get a successful upload response, but a failed Tweet attempt, for anything between 3MB and 5MB.


Ah, that explains it - but that should definitely be explained in the documentation. The docs don’t need to mention specific limits, but that the upload image size limit may differ from the tweet image size limit.


Sorry about the confusion! This question has surfaced many times so we are in the middle of updating the docs to make it clearer. It may take a bit since we are heading into the end of the year, but the updates should be soon.


To follow up on this thread, the documentation has been updated to make this clearer. Here is the diff:

- Maximum image size is 5MB and maximum video size is 15MB.

As of 5 Jan 2016
`- The maximum image size for this endpoint is 5MB. Depending on how the image is used, further limits apply. For example, if the image is attached to a Tweet, the maximum limit in this case is 3MB.

  • The maximum video size for organic Tweets is 15MB.`


Awesome, thanks Jbulava!