{"record":{"id":"677e049ea28fbe2e","repo":"openai/codex","slug":"timed-out-waiting-for-goal-turn-to-start-after-in","errorCode":null,"errorMessage":"timed out waiting for goal turn to start after {int(_GOAL_START_TIMEOUT_S)} seconds","messagePattern":"timed out waiting for goal turn to start after (.+?) seconds","errorType":"exception","errorClass":"CodexError","httpStatus":null,"severity":"error","filePath":"sdk/python/src/openai_codex/client.py","lineNumber":590,"sourceCode":"            raise InvalidRequestError(\n                -32600,\n                f\"thread must be persisted before starting a goal: {thread_id}\",\n            )\n\n        state = self.reserve_goal_operation(thread_id)\n        activated = False\n        try:\n            self.thread_goal_clear(thread_id)\n            state.activate_turn_routing()\n            self.thread_goal_set(\n                thread_id,\n                objective=objective,\n                status=ThreadGoalStatus.active,\n            )\n            activated = True\n            turn_id = state.wait_for_start(_GOAL_START_TIMEOUT_S)\n            if turn_id is None:\n                raise CodexError(\n                    \"timed out waiting for goal turn to start after \"\n                    f\"{int(_GOAL_START_TIMEOUT_S)} seconds\"\n                )\n            return state, turn_id\n        except BaseException as exc:\n            if activated or not isinstance(exc, InvalidRequestError):\n                self.cancel_goal_operation(state)\n            state.finish()\n            self.unregister_goal_operation(state)\n            raise\n\n    def turn_start(\n        self,\n        thread_id: str,\n        input_items: list[JsonObject] | JsonObject | str,\n        params: V2TurnStartParams | JsonObject | None = None,\n    ) -> TurnStartResponse:\n        \"\"\"Start a turn and register its notification queue as early as possible.\"\"\"","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/sdk/python/src/openai_codex/client.py#L572-L608","documentation":"Error \"timed out waiting for goal turn to start after {int(_GOAL_START_TIMEOUT_S)} seconds\" thrown in openai/codex.","triggerScenarios":"Thrown at sdk/python/src/openai_codex/client.py:590 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the Codex runtime is healthy and responsive, then retry starting the goal; investigate runtime logs for the stall."],"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"}