{"record":{"id":"66db8b88c6f9d0c8","repo":"microsoft/semantic-kernel","slug":"no-response-from-the-agent","errorCode":null,"errorMessage":"No response from the agent.","messagePattern":"No response from the agent\\.","errorType":"exception","errorClass":"AgentInvokeException","httpStatus":null,"severity":"warning","filePath":"python/semantic_kernel/agents/bedrock/bedrock_agent.py","lineNumber":350,"sourceCode":"                chat_message_content: ChatMessageContent | None = None\n                for event in events:\n                    if BedrockAgentEventType.CHUNK in event:\n                        chat_message_content = self._handle_chunk_event(event)\n                    elif BedrockAgentEventType.FILES in event:\n                        file_items = self._handle_files_event(event)\n                    elif BedrockAgentEventType.TRACE in event:\n                        trace_metadata = self._handle_trace_event(event)\n\n                if not chat_message_content or not chat_message_content.content:\n                    raise AgentInvokeException(\"Chat message content is expected but not found in the response.\")\n\n                if file_items:\n                    chat_message_content.items.extend(file_items)\n                if trace_metadata:\n                    chat_message_content.metadata.update({\"trace\": trace_metadata})\n\n                if not chat_message_content:\n                    raise AgentInvokeException(\"No response from the agent.\")\n\n                chat_message_content.metadata[\"thread_id\"] = thread.id\n                return AgentResponseItem(message=chat_message_content, thread=thread)\n\n        raise AgentInvokeException(\n            \"Failed to get a response from the agent. Please consider increasing the auto invoke attempts.\"\n        )\n\n    @trace_agent_invocation\n    @override\n    async def invoke(\n        self,\n        messages: str | ChatMessageContent | list[str | ChatMessageContent] | None = None,\n        *,\n        thread: AgentThread | None = None,\n        on_new_message: Callable[[ChatMessageContent], Awaitable[None]] | None = None,\n        agent_alias: str | None = None,\n        arguments: KernelArguments | None = None,","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/bedrock/bedrock_agent.py#L332-L368","documentation":"This AgentInvokeException at line 350 is effectively dead/unreachable code. The preceding guard at line 341 already raises if 'not chat_message_content or not chat_message_content.content'. By line 349, chat_message_content is guaranteed non-None with non-empty content, so 'if not chat_message_content' can never be True. Seeing this message in practice would indicate the code path was restructured or the earlier guard was removed.","triggerScenarios":"In the current source, this raise is unreachable because line 341's guard already catches the None/empty case. It could only fire if the code were modified to remove or weaken the line-341 check.","commonSituations":"Should not occur with the shipping code. If it does, it indicates a local fork/patch removed the line-341 guard or reorganized the block.","solutions":["Treat any occurrence as a sign of a modified/reordered codebase; restore the original line-341 guard.","If you see this in production, diff your local copy against the upstream semantic_kernel release.","Report upstream if it appears in an unmodified official release (it would be a logic bug)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"# This raise is unreachable in the shipping code (line 341 already guards it).\n# If encountered, diff against upstream; restore the line-341 guard.\ntry:\n    resp = await agent.get_response(message=msg)\nexcept AgentInvokeException as e:\n    logger.error(\"Unexpected unreachable path hit: %s\", e)\n    raise","preventionTips":["Keep the line-341 guard intact; do not patch it out.","If forking, preserve the ordering of the None/empty content check before the redundant None check.","Report upstream if seen in an unmodified release."],"tags":["bedrock","dead-code","unreachable","response-parsing","get-response"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}