发起对话接口,处理http 400异常报错
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at com.coze.openapi.service.service.common.AbstractEventCallback.onResponse, line 43, where the response is parsed. Reproduce a 400 response from the initiate-conversation API and inspect how errorStr is handled when it is not JSON. Done means the original HTTP 400 error reason is returned instead of a JsonParseException.
Written by the indexing model from the issue text.
Description
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'missing': was expecting ('true', 'false' or 'null')
at [Source: missing required Host header; line: 1, column: 8]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702) ~[jackson-core-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558) ~[jackson-core-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2839) ~[jackson-core-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1903) ~[jackson-core-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:749) ~[jackson-core-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3850) ~[jackson-databind-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799) ~[jackson-databind-2.8.10.jar!/:2.8.10]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2858) ~[jackson-databind-2.8.10.jar!/:2.8.10]
at com.coze.openapi.service.service.common.AbstractEventCallback.onResponse(AbstractEventCallback.java:43) ~[coze-api-0.1.6.jar!/:?]
at retrofit2.OkHttpCall$1.onResponse$original$uVqJCFM2(OkHttpCall.java:161) ~[retrofit-2.9.0.jar!/:?]
at retrofit2.OkHttpCall$1.onResponse$original$uVqJCFM2$accessor$2S6hJ1Vv(OkHttpCall.java) ~[retrofit-2.9.0.jar!/:?]
at retrofit2.OkHttpCall$1$auxiliary$uF9zybcp.call(Unknown Source) ~[retrofit-2.9.0.jar!/:?]
at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) ~[skywalking-agent.jar:8.6.0]
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java) ~[retrofit-2.9.0.jar!/:?]
at okhttp3.RealCall$AsyncCall.execute$original$bM12vPzc(RealCall.java:174) ~[okhttp-3.14.6.jar!/:?]
at okhttp3.RealCall$AsyncCall.execute$original$bM12vPzc$accessor$WsNoXPUc(RealCall.java) ~[okhttp-3.14.6.jar!/:?]
at okhttp3.RealCall$AsyncCall$auxiliary$USEDluia.call(Unknown Source) ~[okhttp-3.14.6.jar!/:?]
at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) ~[skywalking-agent.jar:8.6.0]
at okhttp3.RealCall$AsyncCall.execute(RealCall.java) ~[okhttp-3.14.6.jar!/:?]
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) ~[okhttp-3.14.6.jar!/:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_202]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_202]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]
怀疑是这里的errorStr并不是json格式,不过你们没打日志,我也不能确定,总之结果就是如果发起对话遇到了http400异常,没有返回我异常原因,而是返回我了一个jsonparse异常。希望尽快处理下吧。
- Dominant language
- Java
- Stars
- 214
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coze-dev/coze-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
PCMConfig类中缺少关键属性 Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
sdk 和官方文档不一致 Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
All issues in coze-dev/coze-java
Similar issues
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Openbug ecr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Needs: Triage Type: Feature request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·