{"record":{"id":"a92d799b25dd14d3","repo":"iflytek/astron-agent","slug":"response-failed-businessexception-responseenum","errorCode":"RESPONSE_FAILED","errorMessage":"BusinessException(ResponseEnum.RESPONSE_FAILED)","messagePattern":"BusinessException\\(ResponseEnum\\.RESPONSE_FAILED\\)","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/extra/OpenPlatformService.java","lineNumber":109,"sourceCode":"                .toString();\n\n        log.info(\n                \"OpenPlatformService syncWorkflowUpdate, url = {}, workflowId = {}, bodyBytes = {}\",\n                url,\n                id,\n                reqBody.getBytes(StandardCharsets.UTF_8).length);\n        String response = OkHttpUtil.post(url, headers, reqBody);\n        FlagResponseEntity responseEntity;\n        try {\n            responseEntity = JSON.parseObject(response, FlagResponseEntity.class);\n        } catch (RuntimeException exception) {\n            log.warn(\n                    \"OpenPlatformService syncWorkflowUpdate response parse failed, url = {}, workflowId = {}, bodyBytes = {}, errorType = {}\",\n                    url,\n                    id,\n                    response == null ? 0 : response.getBytes(StandardCharsets.UTF_8).length,\n                    exception.getClass().getSimpleName());\n            throw new BusinessException(ResponseEnum.RESPONSE_FAILED);\n        }\n        log.info(\n                \"OpenPlatformService syncWorkflowUpdate response, url = {}, workflowId = {}, statusCode = {}\",\n                url,\n                id,\n                responseEntity == null ? null : responseEntity.getCode());\n        if (responseEntity == null || responseEntity.getCode() != 0) {\n            throw new BusinessException(ResponseEnum.RESPONSE_FAILED);\n        }\n        return responseEntity.getData();\n    }\n\n    /**\n     * Builds authentication headers for open platform API requests Generates timestamp and signature\n     * for secure API communication\n     *\n     * @return Map containing authentication headers (timestamp, signature, appId)\n     */","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/extra/OpenPlatformService.java#L91-L127","documentation":"OpenPlatformService.syncWorkflowUpdate parses the open-platform HTTP response; if parsing fails (invalid JSON or incompatible structure) it logs a warn including body size and throws BusinessException(RESPONSE_FAILED). The workflow update result is therefore unavailable.","triggerScenarios":"The open platform sync-workflow endpoint returns a body that cannot be deserialized into the expected response entity: non-JSON payload, HTML gateway error, or changed response schema.","commonSituations":"Open platform outage returning error pages; app id/secret misconfig causing auth redirects to HTML; API version upgrade changing response fields; proxy interference.","solutions":["Check the warn log for url/workflowId/bodyBytes, then reproduce the request to inspect the raw response","Verify open-platform credentials and endpoint URL are for the correct environment","Confirm the response contract after any open-platform SDK/API upgrade","Check gateway/proxy logs for 5xx responses converted to HTML"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (response == null || response.isBlank()) throw new IllegalStateException(\"empty open-platform response\");","typeGuard":"boolean parsesToEntity(String body) {\n    try { return com.alibaba.fastjson.JSON.parseObject(body) != null; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n    openPlatformService.syncWorkflowUpdate(workflowId, payload);\n} catch (BusinessException e) {\n    log.error(\"workflow sync failed to parse response\", e);\n    // queue for retry / alert on open-platform health\n}","preventionTips":["Monitor open-platform availability before syncs","Validate credentials and endpoints per environment","Contract-test the sync response entity","Check gateway behavior on 5xx"],"tags":["json","parsing","open-platform","java"],"backgroundTag":"invalid-json-response","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}