"POST media/upload (APPEND)" is broken



Looks like chunked media upload is broken for at least 3h. The API is returning an empty response (instead of a JSON).

This issue can be reproduced using Twitter’s own Python example:

cesar@ara:~/Temp/large-video-upload-python$ python async-upload.py
Media ID: 875826723807539200
Traceback (most recent call last):
  File "async-upload.py", line 166, in <module>
  File "async-upload.py", line 82, in upload_append
    req = requests.post(url=MEDIA_ENDPOINT_URL, data=request_data, files=files, auth=oauth)
  File "/home/cesar/.local/lib/python2.7/site-packages/requests/api.py", line 111, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/cesar/.local/lib/python2.7/site-packages/requests/api.py", line 57, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/cesar/.local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/cesar/.local/lib/python2.7/site-packages/requests/sessions.py", line 617, in send
  File "/home/cesar/.local/lib/python2.7/site-packages/requests/models.py", line 741, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "/home/cesar/.local/lib/python2.7/site-packages/requests/models.py", line 669, in generate
    raise ContentDecodingError(e)
requests.exceptions.ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing: incorrect header check',))

Are Twitter devs already aware of this issue?

Thanks in advance.


I’m seeing the same problem.

I’ve had the same code running for over a day; but it’s only in the last 7 hours that chunked video uploads to twitter fail. It’s not restricted to a particular account or video. We’ve tried upload videos using multiple videos and accounts.

The following is the error returned; but it’s also appears to be the standard error returned for “auth” issues: {“request”:"/1.1/media/upload.json",“error”:“segment size must be \u003E= 1 java.nio.HeapByteBuffer[pos=64 lim=64 cap=66].”}

It also does not appear to be related to rate limiting; we are way under our post limit. e.g. limit 20000, remaining 19996 left in the current time period.


I’ve reproduced this and will raise internally. I’m unable to provide any further information at this time and this may not be resolved on any given schedule, we thank you for your patience.


Hi, these errors have suddenly stopped over an hour ago, were any changes made?


Hi everyone, we found a code change that caused this problem, and it has been reverted as of about 1.5 hours ago. Thanks for the detailed report, that really helped to narrow down the problem quickly.