binarywang/WxJava · error · WxRuntimeException
「联系我」使用人数默认限制不超过100人(包括部门展开后的人数)
Error message
「联系我」使用人数默认限制不超过100人(包括部门展开后的人数)
What it means
Thrown by WxCpExternalContactServiceImpl.addContactWay() when the contact-way's user list has more than 100 entries. WeChat enforces a 100-user ceiling on a single 'contact me' configuration (including department-expanded counts client-side is the developer's concern, but the SDK guards the raw list size here). It is a WxRuntimeException guarding an upstream API limit.
Source
Thrown at weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java:51
import me.chanjar.weixin.cp.bean.external.interceptrule.WxCpInterceptRuleInfo;
import me.chanjar.weixin.cp.bean.external.interceptrule.WxCpInterceptRuleList;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
/**
* The type Wx cp external contact service.
*
* @author 曹祖鹏, yuanqixun, Mr.Pan, Wang_Wong
*/
@RequiredArgsConstructor
public class WxCpExternalContactServiceImpl implements WxCpExternalContactService {
private final WxCpService mainService;
@Override
public WxCpContactWayResult addContactWay(WxCpContactWayInfo info) throws WxErrorException {
if (info.getContactWay().getUsers() != null && info.getContactWay().getUsers().size() > 100) {
throw new WxRuntimeException("「联系我」使用人数默认限制不超过100人(包括部门展开后的人数)");
}
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_CONTACT_WAY);
return WxCpContactWayResult.fromJson(this.mainService.post(url, info.getContactWay().toJson()));
}
@Override
public WxCpContactWayInfo getContactWay(String configId) throws WxErrorException {
JsonObject json = new JsonObject();
json.addProperty("config_id", configId);
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CONTACT_WAY);
return WxCpContactWayInfo.fromJson(this.mainService.post(url, json.toString()));
}
@Override
public WxCpContactWayList listContactWay(Long startTime, Long endTime, String cursor, Long limit) throws WxErrorException {View on GitHub (pinned to 1c43293a3c)
Solutions
- Split users across multiple contact-way configurations, each <= 100.
- Paginate/filter the user list before calling addContactWay.
- Validate the size before the call and surface a clear error to the operator.
Example fix
// before
service.addContactWay(info); // info.users.size() == 150
// after - partition into batches of 100
List<List<String>> batches = Lists.partition(info.getContactWay().getUsers(), 100);
for (List<String> batch : batches) {
info.getContactWay().setUsers(batch);
service.addContactWay(info);
} Defensive patterns
Strategy: validation
Validate before calling
List<String> users = info.getContactWay().getUsers();
if (users != null && users.size() > 100) {
throw new IllegalArgumentException("contact way users must be <= 100");
}
service.addContactWay(info); Type guard
static boolean withinUserLimit(List<String> users) { return users == null || users.size() <= 100; } Try / catch
null
Prevention
- Partition user lists into batches of <= 100.
- Validate size before addContactWay.
- Avoid putting org-wide rosters on one contact way.
When it happens
Trigger: Creating a 'contact me' QR/code configured for more than 100 users in info.getContactWay().getUsers(); assigning a large department roster flattened to users beyond the limit.
Common situations: Bulk onboarding that puts all sales staff on one contact way; department-to-users expansion not paginated; reusing a contact way for an org-wide team.
Related errors
AI-assisted analysis of binarywang/WxJava@1c43293a3c (2026-08-14).
Data as JSON: /api/errors/f42d89288bc4b06a.
Report an issue: GitHub.