{"record":{"id":"02eee8d760b4942b","repo":"openai/codex","slug":"turn-turn-id-r-is-not-registered-for-streaming","errorCode":null,"errorMessage":"turn {turn_id!r} is not registered for streaming","messagePattern":"turn (.+?) is not registered for streaming","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdk/python/src/openai_codex/_message_router.py","lineNumber":115,"sourceCode":"            # caller receives the TurnHandle and starts streaming.\n            pending = self._pending_turn_notifications.pop(turn_id, deque())\n            self._turn_notifications[turn_id] = turn_queue\n        for notification in pending:\n            turn_queue.put(notification)\n\n    def unregister_turn(self, turn_id: str) -> None:\n        \"\"\"Stop routing future turn events to the stream queue.\"\"\"\n\n        with self._lock:\n            self._turn_notifications.pop(turn_id, None)\n\n    def next_turn_notification(self, turn_id: str) -> Notification:\n        \"\"\"Block until the next notification for a registered turn.\"\"\"\n\n        with self._lock:\n            turn_queue = self._turn_notifications.get(turn_id)\n        if turn_queue is None:\n            raise RuntimeError(f\"turn {turn_id!r} is not registered for streaming\")\n        item = turn_queue.get()\n        if isinstance(item, BaseException):\n            raise item\n        return item\n\n    def register_goal(self, thread_id: str) -> _GoalOperationState:\n        \"\"\"Register one thread-scoped logical goal operation before it starts.\"\"\"\n        state = _GoalOperationState(thread_id=thread_id)\n        state.activate_turn_routing()\n        return self._register_goal(state)\n\n    def reserve_goal(self, thread_id: str) -> _GoalOperationState:\n        \"\"\"Reserve a thread route without accepting physical turns yet.\"\"\"\n        return self._register_goal(_GoalOperationState(thread_id=thread_id))\n\n    def _register_goal(self, state: _GoalOperationState) -> _GoalOperationState:\n        with self._lock:\n            if state.thread_id in self._goal_operations:","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/sdk/python/src/openai_codex/_message_router.py#L97-L133","documentation":"Error \"turn {turn_id!r} is not registered for streaming\" thrown in openai/codex.","triggerScenarios":"Thrown at sdk/python/src/openai_codex/_message_router.py:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start the turn through the streaming API and use the returned turn id; do not attach stream listeners to unknown turns."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}