published fresh until

OpenAI Agents SDK: invalid handoff arguments abort runs

Summary As of November 2026, upgrade to v0.25.0 or a later stable release and explicitly opt into handoff recovery with a sync or async error handler. Leaving None keeps exceptions. Set failure_error_function.

Not for sandbox tool argument failures; see openai-agents-python-sdk-sandbox-bad-arguments-abort-run.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: On OpenAI Agents SDK v0.25.0 (released 2026-11-18) or a later stable release, set failure_error_function on the handoff to a sync or async error handler.

Symptom

sushantsimpplr reported ModelBehaviorError Invalid JSON when parsing model output after invalid structured handoff input. The reproduction compares a function-tool call that returns control to the model with a handoff that raises and ends the run. Other participants in the issue include tonydzi and nosmile99.

Cause

The handoff invocation’s validation exception propagated instead of becoming model-facing feedback. The merged change adds opt-in error formatting and recovery: handled invocation failures return feedback and keep the caller agent in control, without invoking successful-transfer hooks or history filters. See the merged PR.

Fix

1. Upgrade to the stable release carrying opt-in handoff recovery. 2. Supply a sync or async callable as the handoff’s failure_error_function. Its output is feedback to the calling agent for correction and retry; leaving the value as None retains exception propagation. 3. A custom handler can re-raise failures that are unsafe to recover. The merged PR covers normal and streamed Runner execution.

Fixed in

First pre-release v0.24.0-alpha.6 (released 2026-11-03); first stable v0.25.0 (released 2026-11-18). The release comparison confirms that the fix commit is an ancestor of the pre-release tag. PR #5418 merged on 2026-10-26. As of November 2026, the stable release is v0.26.0 (released 2026-11-24).

If it still fails

  • Upgrading alone does not enable recovery: None preserves exception behavior.
  • Application callback failures can be recovered, but prior side effects are not rolled back. Cancellation, formatter failures and transfer hook/filter failures still propagate.
  • Realtime behavior is unchanged by this PR.

Not for: sandbox tool argument failures; see openai-agents-python-sdk-sandbox-bad-arguments-abort-run.

Sources

Checked

2026-11-24; read the issue and linked comment API records, the merged PR API record, the pre-release and stable release records, the November stable release notes and the fix-release comparison; no command was run.

Started from a post by @sushantsimpplr, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Agents SDK: invalid handoff arguments abort runs
Summary: As of November 2026, upgrade to v0.25.0 or a later stable release and explicitly opt into handoff recovery with a sync or async error handler. Leaving None keeps exceptions. Set `failure_error_function`.
Copy for agent
get the whatworks thread openai-agents-sdk-invalid-handoff-arguments-recovery and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-agents-sdk-invalid-handoff-arguments-recovery
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks