{"record":{"id":"1dc732cfb2637786","repo":"microsoft/semantic-kernel","slug":"agent-self-agent-name-did-not-return-any-resp-1dc732","errorCode":null,"errorMessage":"Agent \"{self._agent.name}\" did not return any response nor did not set a handoff agent name.","messagePattern":"Agent \"(.+?)\" did not return any response nor did not set a handoff agent name\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/orchestration/handoffs.py","lineNumber":287,"sourceCode":"    async def _handle_request_message(self, message: HandoffRequestMessage, cts: MessageContext) -> None:\n        \"\"\"Handle a request message from an agent in the handoff group.\"\"\"\n        if message.agent_name != self._agent.name:\n            return\n        logger.debug(f\"{self.id}: Received handoff request message.\")\n\n        response = await self._invoke_agent_with_potentially_no_response(kernel=self._kernel)\n\n        while not self._task_completed:\n            if self._handoff_agent_name:\n                await self.publish_message(\n                    HandoffRequestMessage(agent_name=self._handoff_agent_name),\n                    TopicId(self._internal_topic_type, self.id.key),\n                )\n                self._handoff_agent_name = None\n                break\n\n            if response is None:\n                raise RuntimeError(\n                    f'Agent \"{self._agent.name}\" did not return any response nor did not set a handoff agent name.'\n                )\n\n            await self.publish_message(\n                HandoffResponseMessage(body=response),\n                TopicId(self._internal_topic_type, self.id.key),\n                cancellation_token=cts.cancellation_token,\n            )\n\n            if self._human_response_function:\n                human_response = await self._call_human_response_function()\n                await self.publish_message(\n                    HandoffResponseMessage(body=human_response),\n                    TopicId(self._internal_topic_type, self.id.key),\n                    cancellation_token=cts.cancellation_token,\n                )\n                response = await self._invoke_agent_with_potentially_no_response(\n                    additional_messages=human_response,","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/orchestration/handoffs.py#L269-L305","documentation":"Raised as a RuntimeError in the handoff loop when the agent's invocation returned None (no response content) AND no handoff target was set (self._handoff_agent_name is falsy). The handoff orchestration expects an agent to either produce a response or delegate to another agent; doing neither is a dead end, so it fails.","triggerScenarios":"_invoke_agent_with_potentially_no_response returns None, the loop continues, and because no HandoffRequestMessage was published (the agent did not select a handoff via a select-plugin response), the code reaches `if response is None: raise`. Happens when an agent silently returns nothing and does not choose a handoff.","commonSituations":"An agent whose tool/function returned terminate without producing output; an agent misconfigured so its completion yields an empty message; the handoff-selection plugin not wired correctly so the agent cannot name a successor; a human_response_function path that returned None; model returning empty content with no tool call.","solutions":["Inspect the agent in isolation: confirm it returns a ChatMessageContent or emits a handoff-selection function call.","Ensure the handoff selection tool/plugin is registered so the agent can name the next agent.","If a human_response_function is set, verify it returns a valid response.","Make the agent's instructions explicitly require either an answer or a handoff decision."],"exampleFix":"# Debug the agent standalone to confirm it produces output or a handoff call:\nasync for msg in agent.invoke(messages, thread=thread):\n    print(msg)\n# Fix instructions so the agent always answers or selects a handoff:\nagent = ChatCompletionAgent(\n    service=svc, name=\"triage\",\n    instructions=\"Either answer the user or call the handoff_to function with the next agent.\",\n)","handlingStrategy":"validation","validationCode":"# Confirm the agent produces output or a handoff call before running the orchestration:\nasync def agent_produces(agent, messages, thread):\n    found = False\n    async for msg in agent.invoke(messages, thread=thread):\n        found = True\n    return found","typeGuard":null,"tryCatchPattern":"try:\n    result = await handoff_orchestration.invoke(messages, runtime=runtime)\nexcept RuntimeError as ex:\n    if \"did not return any response\" in str(ex):\n        # inspect the agent directly; fix instructions/handoff tool\n        ...","preventionTips":["Ensure the handoff selection plugin/tool is registered so the agent can choose a successor.","Write agent instructions that require either an answer or a handoff decision.","Test each agent's output in isolation before composing handoffs."],"tags":["orchestration","handoff","empty-response","agent"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}