{"record":{"id":"245c659aac5cb7dc","repo":"binarywang/WxJava","slug":"error-245c65","errorCode":null,"errorMessage":"微信服务端异常，超出重试次数","messagePattern":"微信服务端异常，超出重试次数","errorType":"exception","errorClass":"WxRuntimeException","httpStatus":null,"severity":"warning","filePath":"weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java","lineNumber":422,"sourceCode":"\n        WxError error = e.getError();\n        // -1 系统繁忙, 1000ms后重试\n        if (error.getErrorCode() == -1) {\n          int sleepMillis = this.retrySleepMillis * (1 << retryTimes);\n          try {\n            log.warn(\"微信系统繁忙，{} ms 后重试(第{}次)\", sleepMillis, retryTimes + 1);\n            Thread.sleep(sleepMillis);\n          } catch (InterruptedException e1) {\n            Thread.currentThread().interrupt();\n          }\n        } else {\n          throw e;\n        }\n      }\n    } while (retryTimes++ < this.maxRetryTimes);\n\n    log.warn(\"重试达到最大次数【{}】\", this.maxRetryTimes);\n    throw new WxRuntimeException(\"微信服务端异常，超出重试次数\");\n  }\n\n  private <R, T> R executeInternal(\n      ExecutorAction<R> executor, String uri, String dataForLog, boolean doNotAutoRefreshToken)\n      throws WxErrorException {\n\n    if (uri.contains(\"access_token=\")) {\n      throw new IllegalArgumentException(\"uri参数中不允许有access_token: \" + uri);\n    }\n    String accessToken = getAccessToken(false);\n\n    String effectiveApiHostUrl = this.getWxMaConfig().getEffectiveApiHostUrl();\n    if (!WxMaConfig.DEFAULT_API_HOST_URL.equals(effectiveApiHostUrl)) {\n      uri = uri.replace(WxMaConfig.DEFAULT_API_HOST_URL, effectiveApiHostUrl);\n    }\n\n    String uriWithAccessToken =\n        uri + (uri.contains(\"?\") ? \"&\" : \"?\") + \"access_token=\" + accessToken;","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java#L404-L440","documentation":"Defensive fallback throw as WxRuntimeException after the retry do-while loop exits in BaseWxMaServiceImpl.executeWithRetry(). Under normal control flow this line is unreachable dead code: the catch-block throw at line 398 (error 171) always fires first, because retryTimes + 1 > maxRetryTimes becomes true before the loop condition can become false.","triggerScenarios":"Unreachable in normal flow. Would only fire if the retry logic were refactored in a way that breaks the catch-block guard.","commonSituations":"This line should never execute. If it does, it indicates a logic regression or an extreme integer-overflow edge case in the retry loop.","solutions":["This throw is dead code under current logic — the catch-block throw at line 398 fires first; address error 171 instead","If encountered in production, verify maxRetryTimes is non-negative and the retry loop has not been modified"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Same pattern as error 171 — this throw is dead code under normal flow\n// Unreachable; address error 171 instead","preventionTips":["This throw is unreachable; focus on error 171's prevention tips","Keep maxRetryTimes non-negative to avoid unexpected loop behavior"],"tags":["retry","dead-code","miniapp"],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}