openai/codex · error · ValueError
approval_mode must be one of: {supported}
Error message
approval_mode must be one of: {supported} What it means
Error "approval_mode must be one of: {supported}" thrown in openai/codex.
Source
Thrown at sdk/python/src/openai_codex/_approval_mode.py:26
AskForApproval,
AskForApprovalValue,
)
class ApprovalMode(str, Enum):
"""High-level approval behavior for escalated permission requests."""
deny_all = "deny_all"
auto_review = "auto_review"
def _approval_mode_settings(
approval_mode: ApprovalMode,
) -> tuple[AskForApproval, ApprovalsReviewer | None]:
"""Map the public approval mode to generated app-server start params."""
if not isinstance(approval_mode, ApprovalMode):
supported = ", ".join(mode.value for mode in ApprovalMode)
raise ValueError(f"approval_mode must be one of: {supported}")
match approval_mode:
case ApprovalMode.auto_review:
return (
AskForApproval(root=AskForApprovalValue.on_request),
ApprovalsReviewer.auto_review,
)
case ApprovalMode.deny_all:
return AskForApproval(root=AskForApprovalValue.never), None
case _:
return _assert_never_approval_mode(approval_mode)
def _assert_never_approval_mode(approval_mode: NoReturn) -> NoReturn:
"""Make approval mode mapping exhaustive for static type checkers."""
raise AssertionError(f"Unhandled approval mode: {approval_mode!r}")
View on GitHub (pinned to 339751715c)
Solutions
- Pass one of the supported approval_mode values listed in the message.
When it happens
Trigger: Thrown at sdk/python/src/openai_codex/_approval_mode.py:26 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/73fa6f4b9744ed4e.
Report an issue: GitHub.