binarywang/WxJava · critical · WxErrorException
错误代码:{}, 错误信息:{}
Error message
错误代码:{}, 错误信息:{} What it means
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.
Source
Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceJoddHttpImpl.java:77
if (this.httpProxy != null) {
httpClient.useProxy(this.httpProxy);
}
// 创建 POST 请求
HttpRequest request = HttpRequest
.post(url)
.contentType("application/json")
.body(jsonBody); // 使用 .body() 设置请求体
request.withConnectionProvider(httpClient);
// 发送请求
HttpResponse response = request.send();
// 解析响应
String resultContent = response.bodyText();
WxError error = WxError.fromJson(resultContent, WxType.CP);
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
// 更新 access token
jsonObject = GsonParser.parse(resultContent);
String suiteAccussToken = jsonObject.get("suite_access_token").getAsString();
int expiresIn = jsonObject.get("expires_in").getAsInt();
this.configStorage.updateSuiteAccessToken(suiteAccussToken, expiresIn);
}
return this.configStorage.getSuiteAccessToken();
}
@Override
public void initHttp() {
if (this.configStorage.getHttpProxyHost() != null && this.configStorage.getHttpProxyPort() > 0) {
httpProxy = new ProxyInfo(ProxyInfo.ProxyType.HTTP, configStorage.getHttpProxyHost(),
configStorage.getHttpProxyPort(), configStorage.getHttpProxyUsername(), configStorage.getHttpProxyPassword());
}View on GitHub (pinned to 1c43293a3c)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify suite credentials before relying on token auto-refresh
if (StringUtils.isBlank(configStorage.getSuiteId())
|| StringUtils.isBlank(configStorage.getSuiteSecret())) {
throw new IllegalStateException("suite_id and suite_secret must be configured");
} Try / catch
try {
service.getSuiteAccessToken();
} catch (WxErrorException e) {
WxError error = e.getError();
log.error("Jodd suite token error: code={}, msg={}",
error.getErrorCode(), error.getErrorMsg());
throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
AI-assisted analysis of binarywang/WxJava@1c43293a3c (2026-08-14).
Data as JSON: /api/errors/713595b816f385fa.
Report an issue: GitHub.