{"record":{"id":"c4cd1abed3fbb37c","repo":"iflytek/astron-agent","slug":"tenant-application-credential-verification-request-failed","errorCode":null,"errorMessage":"Tenant application credential verification request failed: {}","messagePattern":"Tenant application credential verification request failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/gateway/impl/HttpTenantGatewayAuthClient.java","lineNumber":80,"sourceCode":"\n        JSONObject requestBody = new JSONObject();\n        requestBody.put(\"api_key\", apiKey);\n        requestBody.put(\"api_secret\", apiSecret);\n\n        Request request = new Request.Builder()\n                .url(verifyAppAuthUrl)\n                .header(TenantInternalApiKey.HEADER, configuredInternalKey)\n                .post(RequestBody.create(requestBody.toJSONString(), JSON_MEDIA_TYPE))\n                .build();\n\n        try (Response response = httpClient.newCall(request).execute()) {\n            if (!response.isSuccessful()) {\n                log.warn(\"tenant verify app auth request failed, status={}\", response.code());\n                return Optional.empty();\n            }\n            return parseAppId(response.body());\n        } catch (IOException | RuntimeException ex) {\n            log.warn(\n                    \"Tenant application credential verification request failed: {}\",\n                    ex.getClass().getSimpleName());\n            return Optional.empty();\n        }\n    }\n\n    private Optional<String> parseAppId(ResponseBody body) throws IOException {\n        if (body == null) {\n            return Optional.empty();\n        }\n        JSONObject responseJson = JSON.parseObject(body.string());\n        Integer code = responseJson == null ? null : responseJson.getInteger(\"code\");\n        if (code == null || code != 0) {\n            return Optional.empty();\n        }\n        JSONObject data = responseJson.getJSONObject(\"data\");\n        if (data == null) {\n            return Optional.empty();","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/gateway/impl/HttpTenantGatewayAuthClient.java#L62-L98","documentation":"verify() catches IOException | RuntimeException around the HTTP execute/parse phase and logs \"Tenant application credential verification request failed: {simple class name}\" before returning Optional.empty(). This is the transport/exception branch: network I/O failure (OkHttp IOException) or an unexpected runtime exception (e.g. JSON parse error in parseAppId) during the verification call.","triggerScenarios":"httpClient.newCall(request).execute() throws IOException (connection refused, timeout, TLS), or parseAppId/response handling throws RuntimeException (malformed JSON, NPE).","commonSituations":"Tenant service unreachable (wrong host/port, DNS failure); connection timeout under load; tenant service returns non-JSON body causing parse failure; OkHttp client misconfigured (bad TLS/proxy).","solutions":["Check backend logs for the exception class name and correlated stack trace (connection vs parse failure).","Verify network reachability and TLS to the tenant service (curl/timeouts).","If parse errors: inspect the actual tenant response body and update parseAppId to the current schema.","Add connect/read timeouts and retry-on-idempotent for transient IOExceptions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check reachability\nboolean reachable = InetAddress.getByName(tenantHost).isReachable(2000);","typeGuard":null,"tryCatchPattern":"try {\n    return authClient.verify(apiKey, apiSecret);\n} catch (RuntimeException e) {\n    log.error(\"tenant verify transport failure\", e);\n    return Optional.empty(); // or fail-open per policy\n}","preventionTips":["Set explicit OkHttp connect/read/write timeouts.","Retry idempotent verification calls with backoff on IOException.","Validate the tenant response schema in tests to catch parse drift.","Monitor tenant service latency/availability."],"tags":["network","http-client","exception-handling","tenant-gateway"],"backgroundTag":"network-request-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}