{"record":{"id":"1fc90adcdaef0570","repo":"binarywang/WxJava","slug":"id-5","errorCode":null,"errorMessage":"使用该配置的客户群ID列表，支持5个","messagePattern":"使用该配置的客户群ID列表，支持5个","errorType":"validation","errorClass":"WxRuntimeException","httpStatus":null,"severity":"error","filePath":"weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java","lineNumber":887,"sourceCode":"  public WxCpCustomerAcquisitionStatistic customerAcquisitionStatistic(String linkId, @NonNull Date startTime,\n                                                                       @NonNull Date endTime) throws WxErrorException {\n    long endTimestamp = endTime.getTime() / 1000L;\n    long startTimestamp = startTime.getTime() / 1000L;\n\n    JsonObject o = new JsonObject();\n    o.addProperty(\"link_id\", linkId);\n    o.addProperty(\"start_time\", startTimestamp);\n    o.addProperty(\"end_time\", endTimestamp);\n\n    String url = this.mainService.getWxCpConfigStorage().getApiUrl(CUSTOMER_ACQUISITION_STATISTIC);\n    return WxCpCustomerAcquisitionStatistic.fromJson(this.mainService.post(url, o));\n  }\n\n\n  @Override\n  public WxCpGroupJoinWayResult addJoinWay(WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException {\n    if (wxCpGroupJoinWayInfo.getJoinWay().getChatIdList() != null && wxCpGroupJoinWayInfo.getJoinWay().getChatIdList().size() > 5) {\n      throw new WxRuntimeException(\"使用该配置的客户群ID列表，支持5个\");\n    }\n    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_JOIN_WAY);\n\n    return WxCpGroupJoinWayResult.fromJson(this.mainService.post(url, wxCpGroupJoinWayInfo.getJoinWay().toJson()));\n  }\n\n  @Override\n  public WxCpBaseResp updateJoinWay(WxCpGroupJoinWayInfo wxCpGroupJoinWayInfo) throws WxErrorException {\n    if (wxCpGroupJoinWayInfo.getJoinWay().getChatIdList() != null && wxCpGroupJoinWayInfo.getJoinWay().getChatIdList().size() > 5) {\n      throw new WxRuntimeException(\"使用该配置的客户群ID列表，支持5个\");\n    }\n    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UPDATE_JOIN_WAY);\n    return WxCpBaseResp.fromJson(this.mainService.post(url, wxCpGroupJoinWayInfo.getJoinWay().toJson()));\n  }\n\n  @Override\n  public WxCpGroupJoinWayInfo getJoinWay(String configId) throws WxErrorException {\n    JsonObject json = new JsonObject();","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java#L869-L905","documentation":"Thrown as WxRuntimeException (unchecked) inside addJoinWay when the group join way's chatIdList contains more than 5 entries. WeChat's auto-grouping 'join way' feature supports at most 5 customer group chat IDs per configuration. This is a client-side guard before the HTTP call to ADD_JOIN_WAY.","triggerScenarios":"Calling addJoinWay with wxCpGroupJoinWayInfo.getJoinWay().getChatIdList() containing more than 5 chat IDs. Happens when a developer tries to associate many customer groups with a single auto-grouping QR code or link.","commonSituations":"Developer fetches all customer group chat IDs from listGroupChat and passes them all into a single join way configuration without realizing the 5-group cap.","solutions":["Limit the chatIdList to at most 5 entries before calling addJoinWay.","If more groups are needed, create multiple join way configurations each covering up to 5 groups.","Pre-validate: if (chatIdList != null && chatIdList.size() > 5) trim or split before constructing the join way info."],"exampleFix":"// before\njoinWayInfo.getJoinWay().setChatIdList(allChatIds); // 8 groups\nservice.addJoinWay(joinWayInfo); // throws > 5\n\n// after\njoinWayInfo.getJoinWay().setChatIdList(allChatIds.subList(0, 5));\nservice.addJoinWay(joinWayInfo);","handlingStrategy":"validation","validationCode":"List<String> chatIds = wxCpGroupJoinWayInfo.getJoinWay().getChatIdList();\nif (chatIds != null && chatIds.size() > 5) {\n    throw new IllegalArgumentException(\"chatIdList exceeds 5 entries\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap chatIdList at 5 entries before calling addJoinWay.","If more groups are needed, create multiple join way configurations.","Log the chatIdList size for debugging if the error is unexpected."],"tags":["weixin-cp","external-contact","group-join-way","validation","limit"],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}