Framework semantic default

Next.js cookies headers async request APIs synchronous usage runtime error Next 15 official docs

Auth middleware/page fails at runtime after request APIs become async.

Next.jsWeb frameworkFramework semantic defaultnext16

Agent Quick Fix

Repair against the current Next.js contract, then keep the change narrow and source-backed.

Product: Next.js
Current-contract area: Next.js cookies()/headers() old synchronous usage
Likely root cause: Auth middleware/page fails at runtime after request APIs become async.
Repair direction: Verifier checks behavior across multiple requests/build modes, not merely compilation. Check request count, response freshness, and render behavior over multiple calls.

Symptom

Auth middleware/page fails at runtime after request APIs become async.

Why This Happens

Local code often type-checks under both old and new framework semantics; the failure depends on the installed framework version and current runtime defaults.

Common Wrong Fixes

  • Changing local code without checking the current external contract.
  • Retrying the same install, build, or API call with no version/source change.
  • Applying a broad unsafe bypass when a narrow compatibility fix is available.

Codex Search Keywords

These are the search terms observed in a neutral Codex validation run for this failure shape.

Next.js cookies headers async request APIs synchronous usage runtime error Next 15 official docs
site:nextjs.org/docs/messages/sync-dynamic-apis cookies headers async
https://nextjs.org/docs/messages/sync-dynamic-apis
'Async Request APIs' in https://nextjs.org/docs/app/guides/upgrading/version-15

Source Trail