question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchElementException in RouteSelector

See original GitHub issue

okhttp 3.7.0 retrofit 2.2.0

All device brands and Android versions are reporting this issue.

It happened for example after I tapped a notification, the app then makes a GET which ended in this exception. It didn’t happen when I recreated the scenario. Device was Pixel, Android 7.1.2, on WLAN.

java.util.NoSuchElementException
  at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:77)
  at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:171)
  at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
  at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
  at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:211)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at com.readystatesoftware.chuck.ChuckInterceptor.intercept(ChuckInterceptor.java:167)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at com.myownpackage.manager.OkHttpManager$AuthenticationInterceptor.intercept(OkHttpManager.java:135)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at com.myownpackage.manager.OkHttpManager$NetworkLoggingInterceptor.intercept(OkHttpManager.java:190)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
  at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
  at okhttp3.RealCall.execute(RealCall.java:69)
  at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
  at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:89)
  at com.myownpackage.ui.ProfileFragment$11.doInBackground(ProfileFragment.java:516)
  at com.myownpackage.ui.ProfileFragment$11.doInBackground(ProfileFragment.java:511)
  at com.nanotasks.AbstractTask.doInBackground(AbstractTask.java:18)
  at com.nanotasks.AbstractTask.doInBackground(AbstractTask.java:7)
  at android.os.AsyncTask$2.call(AsyncTask.java:305)
  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
  at java.lang.Thread.run(Thread.java:761)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:65 (14 by maintainers)

github_iconTop GitHub Comments

29reactions
swankjessecommented, Jun 18, 2017

Fix released as OkHttp 3.8.1.

4reactions
sudhirkhangercommented, Jul 5, 2019
Fatal Exception: java.util.NoSuchElementException
       at okhttp3.internal.connection.RouteSelector.next + 75(RouteSelector.java:75)
       at okhttp3.internal.connection.ExchangeFinder.findConnection + 187(ExchangeFinder.java:187)
       at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection + 108(ExchangeFinder.java:108)
       at okhttp3.internal.connection.ExchangeFinder.find + 88(ExchangeFinder.java:88)
       at okhttp3.internal.connection.Transmitter.newExchange + 169(Transmitter.java:169)
       at okhttp3.internal.connection.ConnectInterceptor.intercept + 41(ConnectInterceptor.java:41)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 142(RealInterceptorChain.java:142)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 117(RealInterceptorChain.java:117)
       at okhttp3.internal.cache.CacheInterceptor.intercept + 94(CacheInterceptor.java:94)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 142(RealInterceptorChain.java:142)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 117(RealInterceptorChain.java:117)
       at okhttp3.internal.http.BridgeInterceptor.intercept + 93(BridgeInterceptor.java:93)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 142(RealInterceptorChain.java:142)
       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept + 88(RetryAndFollowUpInterceptor.java:88)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 142(RealInterceptorChain.java:142)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 117(RealInterceptorChain.java:117)
       at applicationId.network.RetrofitApiManager.lambda$getClient$1 + 45(RetrofitApiManager.java:45)
       at [applicationId.network.-$$Lambda$RetrofitApiManager$T8u62N07bPZuTSKTMwG8MsiSwAU.intercept(Unknown Source)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 142(RealInterceptorChain.java:142)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 117(RealInterceptorChain.java:117)
       at okhttp3.logging.HttpLoggingInterceptor.intercept + 223(HttpLoggingInterceptor.java:223)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 142(RealInterceptorChain.java:142)
       at okhttp3.internal.http.RealInterceptorChain.proceed + 117(RealInterceptorChain.java:117)
       at okhttp3.RealCall.getResponseWithInterceptorChain + 221(RealCall.java:221)
       at okhttp3.RealCall$AsyncCall.execute + 172(RealCall.java:172)
       at okhttp3.internal.NamedRunnable.run + 32(NamedRunnable.java:32)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run + 764(Thread.java:764)](url)

version 3.14.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

NoSuchElementException coming from RouteSelector after ...
After upgrading our android app from okhttp 3.12.2 to 3.14.0, we started seeing this error (stacktrace below) coming through Crashlytics in ...
Read more >
Wrapping non-IOExceptions with IOException - Stack Overflow
I'm trying to solve okhttp internal exception (and any other possible runtime exception): java.util.NoSuchElementException: at okhttp3.internal.
Read more >
Crash NoSuchElementException in RouteSelector of okhttp v3 ...
After upgrading okhttp to v3.7.0, our applications have NoSuchElementException in RouteSelector, the crash log was also reported in ...
Read more >
java.util.NoSuchElementException - Google Groups
Huawei P30 Pro. Fatal Exception: java.util.NoSuchElementException. at okhttp3.internal.connection.RouteSelector.next(RouteSelector.java:75).
Read more >
okhttp3.internal.connection.RouteSelector$Selection java ...
public Selection next() throws IOException { if (!hasNext()) { throw new NoSuchElementException(); } // Compute the next set of routes to attempt.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found