{"record":{"id":"a26fbe94396ea27f","repo":"BerriAI/litellm","slug":"a2a-send-message-failed-non-streaming-message-sen","errorCode":null,"errorMessage":"A2A send_message failed: non-streaming message/send expects the agent's final event to be a Message or Task result.","messagePattern":"A2A send_message failed: non-streaming message/send expects the agent's final event to be a Message or Task result\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/main.py","lineNumber":262,"sourceCode":"\nasync def _send_message(a2a_client: \"A2AClientType\", request: \"SendMessageRequest\") -> \"SendMessageResponse\":\n    \"\"\"Send a non-streaming message via a2a-sdk 1.x and return JSON-RPC response.\"\"\"\n    if _a2a_conversions is None:\n        raise ImportError(\n            \"The 'a2a' package is required for A2A agent invocation. Install it with: pip install a2a-sdk\"\n        )\n\n    pb_request: Final = _to_core_send_message_request(request)\n    last_event = None\n    async for event in a2a_client.send_message(pb_request, context=_get_a2a_call_context(a2a_client)):\n        last_event = event\n    if last_event is None:\n        raise RuntimeError(\"A2A send_message failed: no response received from agent.\")\n\n    stream_compat: Final = _to_compat_stream_response(last_event, request_id=request.id)\n    result: Final = stream_compat.result\n    if not isinstance(result, (Message, Task)):\n        raise RuntimeError(\n            \"A2A send_message failed: non-streaming message/send expects the \"\n            \"agent's final event to be a Message or Task result.\"\n        )\n    return SendMessageResponse(\n        root=SendMessageSuccessResponse(\n            id=request.id,\n            result=result,\n        )\n    )\n\n\nasync def _execute_a2a_send_with_retry(\n    a2a_client: \"A2AClientType\",\n    request: \"SendMessageRequest\",\n    agent_card: Optional[\"AgentCard\"],\n    card_url: str | None,\n    api_base: str | None,\n    agent_name: str | None,","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/a2a_protocol/main.py#L244-L280","documentation":"Error \"A2A send_message failed: non-streaming message/send expects the agent's final event to be a Message or Task result.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/a2a_protocol/main.py:262 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the agent returns a final Message or Task result for message/send; check the agent implementation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}