Vercel · sdk · fg-0246
useChat sends a stale value in DefaultChatTransport body after React state changes
Server always receives the first render value from transport body
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
useChat creates its Chat instance once and kept the transport from the first render, so values captured in transport body never updated. The fix landed in July 2026 (PR 16546).
Fix
Upgrade @ai-sdk/react to 3.0.223 or later on the ai 6 line, or 4.0.12 or later on the ai 7 line. On ai 5, which has no fix, pass per request data in the sendMessage options instead of the transport.
Apply
sendMessage({ text: input }, { body: { subagent } });Affects: @ai-sdk/react before 3.0.223 (ai 6 line) and before 4.0.12 (ai 7 line); the ai 5 line has no fix
Sources
- https://github.com/vercel/ai/issues/7819
- https://github.com/vercel/ai/pull/16546
- https://github.com/vercel/ai/blob/main/packages/react/CHANGELOG.md
- https://github.com/vercel/ai/blob/release-v6.0/packages/react/CHANGELOG.md
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp