{"record":{"id":"b270f86e9a9ec04c","repo":"binarywang/WxJava","slug":"errorcode-errormsg-b270f8","errorCode":null,"errorMessage":"错误代码：{errorCode}, 错误信息：{errorMsg}","messagePattern":"错误代码：(.+?), 错误信息：(.+?)","errorType":"exception","errorClass":"WxErrorException","httpStatus":null,"severity":"error","filePath":"weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/hc/HttpComponentsMediaDownloadRequestExecutor.java","lineNumber":59,"sourceCode":"        uri += '?';\n      }\n      uri += uri.endsWith(\"?\") ? queryParam : '&' + queryParam;\n    }\n\n    HttpGet httpGet = new HttpGet(uri);\n    if (requestHttp.getRequestHttpProxy() != null) {\n      RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();\n      httpGet.setConfig(config);\n    }\n\n    try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpGet);\n         InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response)) {\n      Header[] contentTypeHeader = response.getHeaders(\"Content-Type\");\n      if (contentTypeHeader != null && contentTypeHeader.length > 0) {\n        if (contentTypeHeader[0].getValue().startsWith(ContentType.APPLICATION_JSON.getMimeType())) {\n          // application/json; encoding=utf-8 下载媒体文件出错\n          String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response);\n          throw new WxErrorException(WxError.fromJson(responseContent, wxType));\n        }\n      }\n\n      String fileName = HttpResponseProxy.from(response).getFileName();\n      if (StringUtils.isBlank(fileName)) {\n        fileName = String.valueOf(System.currentTimeMillis());\n      }\n\n      String baseName = FilenameUtils.getBaseName(fileName);\n      if (StringUtils.isBlank(fileName) || baseName.length() < 3) {\n        baseName = String.valueOf(System.currentTimeMillis());\n      }\n\n      return FileUtils.createTmpFile(inputStream, baseName, FilenameUtils.getExtension(fileName), super.tmpDirFile);\n    } catch (HttpException httpException) {\n      throw new ClientProtocolException(httpException.getMessage(), httpException);\n    }\n  }","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/hc/HttpComponentsMediaDownloadRequestExecutor.java#L41-L77","documentation":"Error \"错误代码：{errorCode}, 错误信息：{errorMsg}\" thrown in binarywang/WxJava.","triggerScenarios":"Thrown at weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/hc/HttpComponentsMediaDownloadRequestExecutor.java:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["根据返回的 errorCode 对照微信接口文档确认具体错误原因并修正请求参数。","检查 access_token 是否有效、media_id 是否存在且未过期。"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}