binarywang/WxJava · error · IllegalArgumentException
uri参数中不允许有access_token: {}
Error message
uri参数中不允许有access_token: {} What it means
Error "uri参数中不允许有access_token: {}" thrown in binarywang/WxJava.
Source
Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/impl/BaseWxCpCgServiceImpl.java:212
/**
* Execute internal t.
*
* @param <T> the type parameter
* @param <E> the type parameter
* @param executor the executor
* @param uri the uri
* @param data the data
* @param withoutCorpAccessToken the without Corp access token
* @param req 获取token请求参数
* @return the t
* @throws WxErrorException the wx error exception
*/
protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data,
boolean withoutCorpAccessToken, WxCpCorpGroupCorpGetTokenReq req) throws WxErrorException {
E dataForLog = DataUtils.handleDataWithSecret(data);
if (uri.contains("access_token=")) {
throw new IllegalArgumentException("uri参数中不允许有access_token: " + uri);
}
String uriWithAccessToken;
if (!withoutCorpAccessToken) {
String corpAccessToken = getCorpAccessToken(req.getCorpId(), req.getAgentId(), req.getBusinessType());
uriWithAccessToken = uri + (uri.contains("?") ? "&" : "?") + "access_token=" + corpAccessToken;
} else {
uriWithAccessToken = uri;
}
try {
T result = executor.execute(uriWithAccessToken, data, WxType.CP);
log.debug("\n【请求地址】: {}\n【请求参数】:{}\n【响应数据】:{}", uriWithAccessToken, dataForLog, result);
return result;
} catch (WxErrorException e) {
WxError error = e.getError();
/*
* 发生以下情况时尝试刷新Corp_access_tokenView on GitHub (pinned to 1c43293a3c)
Solutions
- 不要在 uri 参数中手动拼接 access_token,SDK 会自动追加该参数。
- 检查自定义请求地址,移除其中的 access_token 查询参数。
When it happens
Trigger: Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/impl/BaseWxCpCgServiceImpl.java:212 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of binarywang/WxJava@1c43293a3c (2026-08-14).
Data as JSON: /api/errors/38935c310ffc9190.
Report an issue: GitHub.