{"record":{"id":"713595b816f385fa","repo":"binarywang/WxJava","slug":"error-713595","errorCode":null,"errorMessage":"错误代码：{}, 错误信息：{}","messagePattern":"错误代码：(.+?), 错误信息：(.+?)","errorType":"exception","errorClass":"WxErrorException","httpStatus":null,"severity":"critical","filePath":"weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceJoddHttpImpl.java","lineNumber":77,"sourceCode":"      if (this.httpProxy != null) {\n        httpClient.useProxy(this.httpProxy);\n      }\n      // 创建 POST 请求\n      HttpRequest request = HttpRequest\n        .post(url)\n        .contentType(\"application/json\")\n        .body(jsonBody);  // 使用 .body() 设置请求体\n\n      request.withConnectionProvider(httpClient);\n\n      // 发送请求\n      HttpResponse response = request.send();\n\n      // 解析响应\n      String resultContent = response.bodyText();\n      WxError error = WxError.fromJson(resultContent, WxType.CP);\n      if (error.getErrorCode() != 0) {\n        throw new WxErrorException(error);\n      }\n\n      // 更新 access token\n      jsonObject = GsonParser.parse(resultContent);\n      String suiteAccussToken = jsonObject.get(\"suite_access_token\").getAsString();\n      int expiresIn = jsonObject.get(\"expires_in\").getAsInt();\n      this.configStorage.updateSuiteAccessToken(suiteAccussToken, expiresIn);\n    }\n\n    return this.configStorage.getSuiteAccessToken();\n  }\n\n  @Override\n  public void initHttp() {\n    if (this.configStorage.getHttpProxyHost() != null && this.configStorage.getHttpProxyPort() > 0) {\n      httpProxy = new ProxyInfo(ProxyInfo.ProxyType.HTTP, configStorage.getHttpProxyHost(),\n        configStorage.getHttpProxyPort(), configStorage.getHttpProxyUsername(), configStorage.getHttpProxyPassword());\n    }","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceJoddHttpImpl.java#L59-L95","documentation":"Thrown as WxErrorException when the Jodd HTTP implementation of getSuiteAccessToken() receives a non-zero error code from the suite_access_token endpoint. Identical logic to the Apache HttpClient variant (error 164) but uses Jodd HTTP as the transport. The request posts suite_id, suite_secret, and suite_ticket as a JSON body.","triggerScenarios":"Suite access token request fails with errcode != 0: invalid suite_secret (640001), expired suite_ticket (40029), invalid suite_id (40098), or IP whitelist violation (60020).","commonSituations":"suite_secret mismatch; suite_ticket expired or not received via callback; server IP not in whitelist; Jodd HTTP dependency version incompatibility causing request body issues.","solutions":["Verify suite_id and suite_secret exactly match the Third-Party Platform console settings","Ensure suite_ticket callback is functioning and the ticket is refreshed every 10 minutes","Whitelist your server's public IP in the WeChat TP admin console","Inspect WxError errorCode for the specific failure reason"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify suite credentials before relying on token auto-refresh\nif (StringUtils.isBlank(configStorage.getSuiteId())\n    || StringUtils.isBlank(configStorage.getSuiteSecret())) {\n  throw new IllegalStateException(\"suite_id and suite_secret must be configured\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  service.getSuiteAccessToken();\n} catch (WxErrorException e) {\n  WxError error = e.getError();\n  log.error(\"Jodd suite token error: code={}, msg={}\",\n    error.getErrorCode(), error.getErrorMsg());\n  throw e;\n}","preventionTips":["Verify suite_id and suite_secret match the TP console","Ensure suite_ticket callback endpoint is operational","Whitelist your server IP in the TP admin console","Keep Jodd HTTP dependency version compatible with the library's expectations"],"tags":["token","weixin-cp","suite-access-token","authentication","jodd-http","tp"],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}