{"record":{"id":"0289b0a25aa88c9c","repo":"binarywang/WxJava","slug":"error-0289b0","errorCode":null,"errorMessage":"微信服务端异常，超出重试次数！","messagePattern":"微信服务端异常，超出重试次数！","errorType":"exception","errorClass":"WxErrorException","httpStatus":null,"severity":"error","filePath":"weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java","lineNumber":398,"sourceCode":"        uri,\n        dataForLog);\n  }\n\n  private static interface ExecutorAction<R> {\n    R execute(String urlWithAccessToken) throws IOException, WxErrorException;\n  }\n\n  private <R, T> R executeWithRetry(ExecutorAction<R> executor, String uri, String dataForLog)\n      throws WxErrorException {\n    int retryTimes = 0;\n    do {\n      try {\n        return this.executeInternal(executor, uri, dataForLog, false);\n      } catch (WxErrorException e) {\n        if (retryTimes + 1 > this.maxRetryTimes) {\n          log.warn(\"重试达到最大次数【{}】\", maxRetryTimes);\n          // 最后一次重试失败后，直接抛出异常，不再等待\n          throw new WxErrorException(\n              WxError.builder()\n                  .errorCode(e.getError().getErrorCode())\n                  .errorMsg(\"微信服务端异常，超出重试次数！\")\n                  .build());\n        }\n\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;","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java#L380-L416","documentation":"Thrown as WxErrorException when the MiniApp service exhausts all retry attempts for error code -1 (system busy). Unlike the CP variant (error 160), this preserves the original error code via a custom WxError object. The message has a trailing '！' to distinguish it from error 172's WxRuntimeException.","triggerScenarios":"WeChat MiniApp API repeatedly returns errcode -1 (system busy) across all retry attempts with exponential backoff in executeWithRetry(). The throw fires at line 398 when retryTimes + 1 > maxRetryTimes.","commonSituations":"WeChat backend instability; high-frequency MiniApp API calls during peak traffic; maxRetryTimes set too low; rate limiting manifesting as -1 errors.","solutions":["Check WeChat MiniApp platform status for ongoing outages","Increase retry budget: service.setMaxRetryTimes(10) and service.setRetrySleepMillis(2000)","Reduce API call frequency during peak hours to avoid -1 system busy responses","Implement a circuit breaker pattern (e.g., Resilience4j) for sustained outage resilience"],"exampleFix":"// before\nwxMaService.setMaxRetryTimes(5);\n\n// after\nwxMaService.setMaxRetryTimes(10);\nwxMaService.setRetrySleepMillis(2000);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  wxMaService.execute(executor, uri);\n} catch (WxErrorException e) {\n  if (\"微信服务端异常，超出重试次数！\".equals(e.getError().getErrorMsg())) {\n    log.error(\"MiniApp API unavailable after {} retries\", maxRetryTimes);\n    // fall back to cached data, queue for later, or alert\n  } else {\n    throw e;\n  }\n}","preventionTips":["Tune maxRetryTimes and retrySleepMillis based on your latency and reliability requirements","Monitor WeChat MiniApp platform status and set up proactive alerts","Use a circuit breaker to fail-fast during sustained outages","Reduce call frequency during peak hours to avoid triggering -1 errors"],"tags":["retry","network","miniapp","system-busy"],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}