openai/codex · error · RuntimeError

the connected Codex runtime did not activate goal mode for t

Error message

the connected Codex runtime did not activate goal mode for this turn

What it means

Error "the connected Codex runtime did not activate goal mode for this turn" thrown in openai/codex.

Source

Thrown at sdk/python/src/openai_codex/_goal.py:290

        if isinstance(payload, TurnCompletedNotification):
            self.active = False
            self.last_completed = payload
            if payload.turn.status == TurnStatus.interrupted:
                return [
                    self._completion(
                        notification.method,
                        self.failed_completion or payload,
                    )
                ], True
            if payload.turn.status == TurnStatus.failed:
                self.failed_completion = payload
                if self.cleared or _terminal_goal_status(self.status):
                    self.state.finish()
                    return [self._completion(notification.method, payload)], True
                return [], False
            if self.status is None and not self.cleared:
                raise RuntimeError(
                    "the connected Codex runtime did not activate goal mode for this turn"
                )
            if self.cleared or _terminal_goal_status(self.status):
                self.state.finish()
                return [
                    self._completion(
                        notification.method,
                        self.failed_completion or payload,
                    )
                ], True
            return [], False

        events = [_logical_notification(notification, logical_turn_id)]
        if isinstance(payload, ThreadGoalUpdatedNotification):
            self.status = payload.goal.status
            if self.status == ThreadGoalStatus.active:
                self.cleared = False
            events = []

View on GitHub (pinned to 339751715c)

Solutions

  1. Start the goal through the SDK goal API against a runtime version that supports goal mode; ensure the turn was created as a goal turn.

When it happens

Trigger: Thrown at sdk/python/src/openai_codex/_goal.py:290 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/3f8e50107a6f6d40. Report an issue: GitHub.