{"record":{"id":"9bc4c79f922252c3","repo":"iflytek/astron-agent","slug":"workflow-call-failed","errorCode":"WORKFLOW_CALL_FAILED","errorMessage":"Workflow call failed.","messagePattern":"Workflow call failed\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/AgentWorkflowRuntimeService.java","lineNumber":160,"sourceCode":"        JSONObject body = new JSONObject();\n        body.put(\"flow_id\", definition.getFlowId());\n        body.put(\"uid\", StringUtils.defaultIfBlank(uid, \"agent\"));\n        body.put(\"parameters\", modelArgs == null ? new JSONObject() : modelArgs);\n        body.put(\"history\", new JSONArray());\n        body.put(\"stream\", false);\n\n        try {\n            String responseBody = workflowChatRunClient.chat(body);\n            return extractResult(definition, responseBody);\n        } catch (Exception e) {\n            log.warn(\n                    \"Workflow run failed, flowId: {}, errorType: {}\",\n                    definition.getFlowId(),\n                    e.getClass().getSimpleName());\n            return errorContent(\"WORKFLOW_CALL_FAILED\", \"Workflow call failed.\");\n        }\n    }\n\n    private List<Workflow> selectByFlowIds(List<String> flowIds) {\n        List<Workflow> workflows =\n                workflowMapper.selectList(new LambdaQueryWrapper<Workflow>().in(Workflow::getFlowId, flowIds));\n        if (workflows == null) {\n            return List.of();\n        }\n        return workflows.stream()\n                .filter(w -> w != null && !Boolean.TRUE.equals(w.getDeleted()))\n                .toList();\n    }\n\n    private AgentWorkflowDefinition buildDefinition(Workflow workflow, Set<String> usedNames) {\n        String name = StringUtils.trimToEmpty(workflow.getName());\n        String description = StringUtils.trimToEmpty(workflow.getDescription());\n        String combined = StringUtils.isBlank(description) ? name : name + \": \" + description;\n        return AgentWorkflowDefinition.builder()\n                .flowId(workflow.getFlowId())\n                .name(name)","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/AgentWorkflowRuntimeService.java#L142-L178","documentation":"AgentWorkflowRuntimeService.runWorkflow (in AgentWorkflowRuntimeService) executes a workflow invocation via the workflow runtime handler; any exception caught in the surrounding try is logged as 'Workflow run failed' with the flowId and converted into error content with code WORKFLOW_CALL_FAILED. The agent receives a controlled error string instead of an exception, indicating the workflow call never produced a usable result.","triggerScenarios":"toolServiceCallHandler-style workflow run throws: core/workflow service unreachable, HTTP timeout, non-2xx response, or protocol/serialization exception while invoking the flow identified by definition.getFlowId().","commonSituations":"core/workflow service down or restarted; workflow version deleted/published incorrectly so the run endpoint 404s or 500s; long-running flow exceeding the HTTP timeout; network policy blocking toolkit→core/workflow traffic.","solutions":["Check the log line 'Workflow run failed, flowId' for errorType to identify the exception class","Verify the core/workflow service is healthy and reachable from the toolkit service","Confirm the flowId exists and has a published/running version","Check HTTP client timeouts against the workflow's expected execution duration","Retry the call for transient failures; return WORKFLOW_CALL_FAILED content to the agent for graceful degradation"],"exampleFix":"// before\nreturn errorContent(\"WORKFLOW_CALL_FAILED\", \"Workflow call failed.\");\n// after\nif (isTransient(e)) {\n    response = toolServiceCallHandler.toolRun(request); // retry once\n} else {\n    return errorContent(\"WORKFLOW_CALL_FAILED\", \"Workflow call failed: \" + e.getClass().getSimpleName());\n}","handlingStrategy":"try-catch","validationCode":"if (flowId == null || flowId.isBlank()) return errorContent(\"WORKFLOW_CALL_FAILED\", \"missing flowId\");","typeGuard":null,"tryCatchPattern":"try { response = handler.run(req); } catch (Exception e) { log.warn(\"workflow {} failed: {}\", flowId, e.getClass().getSimpleName(), e); return errorContent(\"WORKFLOW_CALL_FAILED\", \"Workflow call failed.\"); }","preventionTips":["Health-check core/workflow before dispatching runs","Confirm flowId has a published version before invocation","Align HTTP timeouts with workflow execution duration","Retry transient network errors once before returning error content"],"tags":["workflow","rpc","error-handling"],"backgroundTag":"api-request-failed","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"}