Failed to establish a new connection


Hi, I meet a problem high frequency recently :when we requesting twitter api to get insight, it return error like this.

But when we request the same link later, it return right.
Expect your reply! Thanks!


Hi @wangdao1! Are you sure it’s not from your own server? Maybe your server lost internet connectivity just when you were making that call. Just an idea… What Ads API SDK are you using?


hi, we use python sdk. Our server’s network is ok when we request!


@majoritasdev hi, when we get this error, our network is ok. we use ‘ping’ ,it is ok ,no packet dropout.And the error only happen when we ‘post /2/stats/jobs/accounts/******’ .


Hi @wangdao1. Ok. Then I don’t know, we’ll wait to see what someone from the Twitter Staff says.


Hey @wangdao1

Do you have a sense of when the issue occurred (specifically the date/time)? We can check on our end to see if there was any downtime.



@imit8me hi, today we get this error again. The utctime is ‘2018-05-18 01:29:09’


@imit8me When we meet this error today,our network is ok . Picture is our server network status, we don`t loss any packet.


That is really strange. I don’t see any issues on our end. Are you seeing these issues with all endpoints, or just when calling the stats endpoints? Additionally, can you provide the exact error response you’re seeing?



ok. This two pictures are the error info. yeah,we meet when calling the stats endpoints, other endpoints we don`t meet this error.


@imit8me This error is not occured inevitable, but recently it occured every day one time.


Hi @wangdao1

The error only happens some % of the time, correct?

I general, when using our API you should build in retry mechanisms AND backoff mechanisms. If your system is calling in parallel, the # of retries could be too high because you are not backing off. All of our endpoints have basic rate limiting but the jobs POST one you should not be calling it so frequently that you are hitting this error very often.

When you implement backoff please implement exponential backoff so that the job POSTs do not continue to try to retry over and over when you get the errors. Please see posts like for example of how to catch exceptions.

Only if the error is happening persistently and very often would I think it’s a problem with connection layer, and even then I would first suspect something is wrong with the libraries being used.




@JBabichJapan hi,thanks. From yesterday we catch exceptions and when we get this error, we sleep some time,then we request again, it`s ok.