{"record":{"id":"daf01926ac83da62","repo":"iflytek/astron-agent","slug":"response-failed-addresult-message","errorCode":"RESPONSE_FAILED","errorMessage":"addResult.message()","messagePattern":"addResult\\.message\\(\\)","errorType":"exception","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java","lineNumber":1090,"sourceCode":"                        .eq(spaceId == null, Workflow::getUid, UserInfoManagerHandler.getUserId())\n                        .eq(spaceId != null, Workflow::getSpaceId, spaceId)\n                        .eq(Workflow::getDeleted, false)\n                        .last(\"limit 1\"));\n        if (one != null) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_NAME_EXISTED);\n        }\n\n        createReq.setAppId(commonConfig.getAppId());\n        if (Boolean.TRUE.equals(createReq.getCommonUser())) {\n            // Dedicated cloud commonUser logic\n            createReq.setAppId(commonConfig.getAppId());\n            createReq.setDomain(\"generalv3.5\");\n        }\n\n        // Core system - add protocol, return flowId\n        ApiResult<String> addResult = callProtocolAdd(createReq);\n        if (addResult.code() != 0) {\n            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, addResult.message());\n        }\n\n        // Product side database storage\n        Workflow workflow = new Workflow();\n        org.springframework.beans.BeanUtils.copyProperties(createReq, workflow);\n        if (createReq.getAdvancedConfig() != null) {\n            workflow.setAdvancedConfig(new JSONObject(createReq.getAdvancedConfig()).toJSONString());\n        }\n        Date now = new Date();\n        workflow.setCreateTime(now);\n        workflow.setUpdateTime(now);\n        workflow.setFlowId(addResult.data());\n        if (spaceId != null)\n            workflow.setSpaceId(spaceId);\n        workflow.setUid(UserInfoManagerHandler.getUserId());\n        if (StringUtils.isBlank(workflow.getAvatarColor()))\n            workflow.setAvatarColor(\"#FFEAD5\");\n        if (StringUtils.isBlank(workflow.getAvatarIcon()))","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L1072-L1108","documentation":"After passing the duplicate-name check, WorkflowService.create calls the core 'protocol add' API via callProtocolAdd(createReq). If the returned ApiResult code() != 0, the upstream protocol service rejected the flow creation; the code rethrows RESPONSE_FAILED with the upstream message. This means the core workflow engine refused to create the flow.","triggerScenarios":"create() invokes callProtocolAdd and the core add protocol responds with a non-zero code — e.g. core service rejects the payload (invalid domain/default model config like generalv3.5, app misconfiguration) or core is degraded and returns an error envelope.","commonSituations":"Core workflow service down or partially deployed, wrong appId configured in commonConfig, protocol contract change between console and core versions, invalid model/domain defaults.","solutions":["Inspect addResult.message() in the exception/logs to see the core-side rejection reason","Verify commonConfig.getAppId() and domain defaults match what the core protocol service expects","Check core workflow service health/logs around the failing request","Ensure console and core versions agree on the WorkflowReq contract"],"exampleFix":"// before\nApiResult<String> addResult = callProtocolAdd(createReq);\nif (addResult.code() != 0) {\n    throw new BusinessException(ResponseEnum.RESPONSE_FAILED, addResult.message());\n}\n// after\nApiResult<String> addResult = callProtocolAdd(createReq);\nif (addResult.code() != 0) {\n    log.error(\"protocol add failed, name={}, code={}, msg={}\", createReq.getName(), addResult.code(), addResult.message());\n    throw new BusinessException(ResponseEnum.RESPONSE_FAILED, addResult.message());\n}","handlingStrategy":"try-catch","validationCode":"// Pre-flight: ping core health before create\nApiResult<Boolean> health = coreHealthClient.ping();\nif (health == null || health.code() != 0) throw new IllegalStateException(\"core workflow service unavailable\");","typeGuard":null,"tryCatchPattern":"try {\n    workflowService.create(req);\n} catch (BusinessException e) {\n    log.error(\"workflow create rejected by core: {}\", e.getMessage());\n    throw new ServiceException(\"core rejected flow creation: \" + e.getMessage(), e);\n}","preventionTips":["Keep commonConfig appId/domain values in sync with core expectations","Monitor core service health and alert before creates fail","Pin console/core versions during deploys to avoid protocol drift","Log addResult.code()/message() on every protocol call"],"tags":["workflow","upstream-api","api-error"],"backgroundTag":"upstream-api-error","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"}