{"record":{"id":"8df7c7598faf0a24","repo":"iflytek/astron-agent","slug":"workflow-exec-resp-format-error","errorCode":"WORKFLOW_EXEC_RESP_FORMAT_ERROR","errorMessage":"Workflow response format error. Response: {result_content}, Expected deserialization keys: {self.output_identifier}","messagePattern":"Workflow response format error\\. Response: (.+?), Expected deserialization keys: (.+?)","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/flow/flow_node.py","lineNumber":453,"sourceCode":"        Different output modes handle the response content differently:\n        - VARIABLE_MODE: Parse JSON content as structured variables\n        - OLD_PROMPT_MODE: Return content as a single output\n        - PROMPT_MODE: Return both content and reasoning content\n\n        :param output_mode: Configured output mode for the workflow\n        :param result_content: Main content from the workflow response\n        :param result_reasoning_content: Reasoning content from the workflow response\n        :return: Processed outputs dictionary\n        :raises CustomException: When output mode is invalid or content parsing fails\n        \"\"\"\n        outputs = {}\n\n        if output_mode == EndNodeOutputModeEnum.VARIABLE_MODE.value:\n            # Parse JSON content as structured workflow parameters\n            try:\n                outputs = json.loads(result_content)\n            except Exception as e:\n                raise CustomException(\n                    err_code=CodeEnum.WORKFLOW_EXEC_RESP_FORMAT_ERROR,\n                    cause_error=f\"Workflow response format error. Response: {result_content}, \"\n                    f\"Expected deserialization keys: {self.output_identifier}\",\n                ) from e\n        elif output_mode == EndNodeOutputModeEnum.OLD_PROMPT_MODE.value:\n            # Return content as a single output parameter\n            outputs[self.output_identifier[0]] = result_content\n        elif output_mode == EndNodeOutputModeEnum.PROMPT_MODE.value:\n            # Return both content and reasoning content\n            outputs[\"content\"] = result_content\n            outputs[\"reasoning_content\"] = result_reasoning_content\n        else:\n            raise CustomException(\n                err_code=CodeEnum.WORKFLOW_EXECUTION_ERROR,\n                cause_error=f\"Invalid workflow output mode: {output_mode}\",\n            )\n\n        return outputs","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/flow/flow_node.py#L435-L471","documentation":"In VARIABLE_MODE the flow node expects the child workflow's end node to return a JSON object parseable against output_identifier keys. When json.loads fails (or the body is not valid JSON), the node raises WORKFLOW_EXEC_RESP_FORMAT_ERROR including the raw response and expected keys.","triggerScenarios":"_handle_outputs with output_mode==VARIABLE_MODE calls json.loads(result_content) and it throws — e.g. the response is a plain string, HTML error page, or truncated JSON.","commonSituations":"Child workflow's end node not configured in variable mode so it returns free text; upstream proxy returned an HTML error page; response truncated at size/streaming limits; encoding issues corrupting JSON.","solutions":["Inspect the raw response in the error's cause_error to see what was actually returned","Reconfigure the child workflow's end node to output variables (VARIABLE_MODE) so the body is JSON","Check intermediate proxies/gateways for HTML error pages replacing the JSON body","Fix JSON escaping/encoding in the child's end-node output values"],"exampleFix":"// child end-node output, before\n\"done\"  // plain text, not JSON\n// after\n{\"result\": \"done\"}  // JSON object matching output_identifier","handlingStrategy":"type-guard","validationCode":"def is_valid_json_object(s: str) -> bool:\n    try:\n        return isinstance(json.loads(s), dict)\n    except Exception:\n        return False","typeGuard":"def parse_outputs(s: str):\n    try:\n        v = json.loads(s)\n        return v if isinstance(v, dict) else None\n    except json.JSONDecodeError:\n        return None","tryCatchPattern":"try:\n    outputs = await flow_node.async_execute(ctx)\nexcept CustomException as e:\n    if e.err_code == CodeEnum.WORKFLOW_EXEC_RESP_FORMAT_ERROR:\n        logger.error('child returned non-JSON: %s', e.cause_error)\n        # inspect cause_error, fix child end-node mode, or retry once\n    raise","preventionTips":["Always configure the child end node in variable mode when the parent expects variables","Add a contract test asserting the child returns JSON for the declared output_identifier","Check proxies don't inject HTML error pages","Validate child JSON output in its own debug runs before publishing"],"tags":["json","workflow","parsing"],"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"}