Getting "media parameter is invalid" with a photo smaller then 3MB



I’m using the media/upload entry point to upload a photo and then publish a tweet with this photo.
The media is uploaded successfully and I’m receiving media_id_string.
I then use the media_id_string to publish a tweet using the statuses/update entry point.
Sometimes I get the error “media parameter is invalid”

If I try to publish the same tweet with the same photo afterwards, I might succeed (the problem is not consistent)

Looking for the same issue in the forums I see only references to this error message when the photo is bigger then 3MB (which is not the case)

Any idea why this is happening? Do I need to add some kind of delay between the upload of the media and the creation of the status?


@LevonaC Could you provide a link to the source image? You don’t have to add any delay between upload and creation of the status.


Here is an example to a photo that it’s publish failed.

Let me just emphasize that the issue is inconsistent.
If you try to publish with the same image again, you will probably succeed

Thank you


@LevonaC You are right. I was unable to repro it after multiple attempts. It could be a temporary failure.

If you are still seeing intermittent failures then please could you provide request and response logs for the failure case?


Well, since we have experienced this issue large number of times we had to reduce our use of this entry point to the minimum possible (we reverted back to using the upload_with_media entry point when publishing with a single photo), so unfortunately, I don’t really have any recent logs to share.