Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

无网状态下,SDK初始化时会抛出异常,应用捕获不到

Open
#140 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java

Research direction

Reproduce the SDK initialization while offline and trace the call path from AuthenticationInterceptor through JWTOAuth, JWTOAuthClient, and OAuthClient.getAccessToken. Check how the SocketTimeoutException from the OkHttp and RxJava chain propagates during initialization; done means the application can receive and handle the offline failure instead of an uncaught exception.

Written by the indexing model from the issue text.

Description

java.net.SocketTimeoutException: failed to connect to api.coze.cn/221.8.93.168 (port 443) from /10.245.3.40 (port 38488) after 5000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:236)
at libcore.io.IoBridge.connect(IoBridge.java:180)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:621)
at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:1)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:9)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:16)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:38)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:1)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:7)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:7)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:2)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:27)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:22)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:7)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at com.coze.openapi.service.utils.UserAgentInterceptor.intercept(UserAgentInterceptor.java:6)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:16)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:5)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:8)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:5)
at io.reactivex.Observable.subscribe(Observable.java:14)
at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:1)
at io.reactivex.Single.subscribe(Single.java:13)
at io.reactivex.Single.blockingGet(Single.java:2)
at com.coze.openapi.service.auth.OAuthClient.execute(OAuthClient.java:1)
at com.coze.openapi.service.auth.OAuthClient.getAccessToken(OAuthClient.java:5)
at com.coze.openapi.service.auth.JWTOAuthClient.doGetAccessToken(JWTOAuthClient.java:25)
at com.coze.openapi.service.auth.JWTOAuthClient.getAccessToken(JWTOAuthClient.java:13)
at com.coze.openapi.service.auth.JWTOAuth.token(JWTOAuth.java:11)
at com.coze.openapi.service.service.AuthenticationInterceptor.intercept(AuthenticationInterceptor.java:5)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:12)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:16)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:6)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)

Dominant language
Java
Stars
214
Forks
97
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coze-dev/coze-java

All issues in coze-dev/coze-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.