{"record":{"id":"70523494e10c4361","repo":"microsoft/semantic-kernel","slug":"the-magentic-manager-is-not-started-yet-make-sure","errorCode":null,"errorMessage":"The Magentic manager is not started yet. Make sure to send a start message first.","messagePattern":"The Magentic manager is not started yet\\. Make sure to send a start message first\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/orchestration/magentic.py","lineNumber":554,"sourceCode":"        \"\"\"Handle the start message for the Magentic One manager.\"\"\"\n        logger.debug(f\"{self.id}: Received Magentic One start message.\")\n\n        self._context = MagenticContext(\n            task=message.body,\n            participant_descriptions=self._participant_descriptions,\n        )\n\n        # Initial planning\n        self._task_ledger = await self._manager.plan(self._context.model_copy(deep=True))\n\n        await self._run_outer_loop(ctx.cancellation_token)\n\n    @message_handler\n    @ActorBase.exception_handler\n    async def _handle_response_message(self, message: MagenticResponseMessage, ctx: MessageContext) -> None:\n        \"\"\"Handle the response message for the Magentic One manager.\"\"\"\n        if self._context is None or self._task_ledger is None:\n            raise RuntimeError(\"The Magentic manager is not started yet. Make sure to send a start message first.\")\n\n        if message.body.role != AuthorRole.USER:\n            self._context.chat_history.add_message(\n                ChatMessageContent(\n                    role=AuthorRole.USER,\n                    content=f\"Transferred to {message.body.name}\",\n                )\n            )\n        self._context.chat_history.add_message(message.body)\n\n        logger.debug(f\"{self.id}: Running inner loop.\")\n        await self._run_inner_loop(ctx.cancellation_token)\n\n    async def _run_outer_loop(self, cancellation_token: CancellationToken) -> None:\n        if self._context is None or self._task_ledger is None:\n            raise RuntimeError(\"The Magentic manager is not started yet. Make sure to send a start message first.\")\n\n        # 1. Publish the rendered task ledger to the group chat.","sourceCodeStart":536,"sourceCodeEnd":572,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/orchestration/magentic.py#L536-L572","documentation":"_handle_response_message is the actor callback for MagenticResponseMessage. It reads self._context and self._task_ledger, both of which are populated only by _handle_start_message. If a response message arrives before the start message was processed, the actor is in an uninitialized state and cannot proceed, so it raises.","triggerScenarios":"The Magentic manager actor receives a MagenticResponseMessage before _handle_start_message has run — i.e. self._context or self._task_ledger is None. Typically only happens if messages are published to the internal topic manually or start-message delivery/processing failed.","commonSituations":"Publishing MagenticResponseMessage directly to the orchestration's internal topic. A failed/canceled start handler that left state half-initialized. Custom actor wiring that bypasses the standard start handshake.","solutions":["Start the orchestration only via `await orchestration.invoke(task, runtime)` so the start message is always sent first.","Do not publish MagenticResponseMessage/MagenticRequestMessage to the internal topic yourself.","Ensure the start handler ran without exception; check the exception_callback registered with the manager actor."],"exampleFix":"// before\n# manually publishing to internal topic before start -> raises\nawait runtime.send_message(MagenticResponseMessage(body=msg), manager_id)\n\n// after\nresult = await orchestration.invoke(task, runtime)\nawait result.get()","handlingStrategy":"validation","validationCode":"# Don't publish MagenticResponseMessage yourself; start via invoke()\nresult = await orchestration.invoke(task_msg, runtime)\n# The actor only receives response messages after the start handler initialized state.","typeGuard":null,"tryCatchPattern":"try:\n    result = await orchestration.invoke(task_msg, runtime)\n    await result.get()\nexcept RuntimeError as e:\n    if \"not started yet\" in str(e):\n        log.error(\"Start handshake failed; inspect exception_callback.\")\n    raise","preventionTips":["Never publish MagenticResponseMessage/MagenticRequestMessage to the internal topic directly.","Always start the orchestration through invoke().","Register an exception_callback on the actor to surface a failed start handler."],"tags":["semantic-kernel","magentic","actor","lifecycle","internal"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}