binarywang/WxJava · warning · IllegalArgumentException
可填充个数:0 ~ 100。超过100个需分批调用。
Error message
可填充个数:0 ~ 100。超过100个需分批调用。
What it means
Thrown as IllegalArgumentException (unchecked) in validateParameters when the operation is SERVICER_DEL and userIdList contains more than 100 entries. WeChat's delete-servicer API caps userid_list at 100 per call; larger batches must be split. This guard fires before the HTTP request.
Source
Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpKfServiceImpl.java:99
@Override
public WxCpKfServicerOpResp delServicer(String openKfid, List<String> userIdList) throws WxErrorException {
return servicerOp(openKfid, userIdList, null, SERVICER_DEL);
}
@Override
public WxCpKfServicerOpResp delServicer(String openKfid, List<String> userIdList, List<String> departmentIdList) throws WxErrorException {
validateParameters(SERVICER_DEL, userIdList, departmentIdList);
return servicerOp(openKfid, userIdList, departmentIdList, SERVICER_DEL);
}
private void validateParameters(String uri, List<String> userIdList, List<String> departmentIdList) {
if ((userIdList == null || userIdList.isEmpty()) && (departmentIdList == null || departmentIdList.isEmpty())) {
throw new IllegalArgumentException("userid_list和department_id_list至少需要填其中一个");
}
if (SERVICER_DEL.equals(uri)) {
if (userIdList != null && userIdList.size() > 100) {
throw new IllegalArgumentException("可填充个数:0 ~ 100。超过100个需分批调用。");
}
if (departmentIdList != null && departmentIdList.size() > 100) {
throw new IllegalArgumentException("可填充个数:0 ~ 100。超过100个需分批调用。");
}
} else {
if (userIdList != null && userIdList.size() > 100) {
throw new IllegalArgumentException("可填充个数:0 ~ 100。超过100个需分批调用。");
}
if (departmentIdList != null && departmentIdList.size() > 20) {
throw new IllegalArgumentException("可填充个数:0 ~ 20。");
}
}
}
private WxCpKfServicerOpResp servicerOp(String openKfid, List<String> userIdList, List<String> departmentIdList, String uri) throws WxErrorException {
String url = cpService.getWxCpConfigStorage().getApiUrl(uri);
JsonObject json = new JsonObject();View on GitHub (pinned to 1c43293a3c)
Solutions
- Split userIdList into batches of 100 or fewer and call delServicer in a loop.
- Use a utility like Lists.partition(userIdList, 100) (Guava) or manual subList partitioning.
- Pre-validate the list size and warn the user if chunking is needed.
Example fix
// before
List<String> allUsers = getAllServicerUserIds(); // 250 entries
service.delServicer(openKfid, allUsers, null); // throws > 100
// after
List<List<String>> batches = partition(allUsers, 100);
for (List<String> batch : batches) {
service.delServicer(openKfid, batch, null);
} Defensive patterns
Strategy: validation
Validate before calling
if (userIdList != null && userIdList.size() > 100) {
// partition into batches of 100
List<List<String>> batches = partition(userIdList, 100);
for (List<String> batch : batches) {
service.delServicer(openKfid, batch, null);
}
return;
} Prevention
- Partition userIdList into batches of 100 before calling delServicer.
- Use Guava Lists.partition or a custom partition utility for clean batch processing.
- Log the number of batches for audit trail when processing large deletions.
When it happens
Trigger: Calling delServicer(openKfid, userIdList, departmentIdList) where userIdList.size() > 100 and the SERVICER_DEL path is taken. Happens during bulk removal of many customer service agents at once.
Common situations: Organization restructures and needs to remove a large set of servicers; developer passes the full list without chunking.
Related errors
- 可填充个数:0 ~ 20。
- userid_list和department_id_list至少需要填其中一个
- 使用该配置的客户群ID列表,支持5个
- 更新「联系我」方式需要指定configId
- userid 不能为空
AI-assisted analysis of binarywang/WxJava@1c43293a3c (2026-08-14).
Data as JSON: /api/errors/b343d9caadff0581.
Report an issue: GitHub.