You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After spending hours debugging this issue, I found this PR #4990 that helped me understand and fix the root cause. However, even after the fix was merged, the issue still seems to persist in some environments.
Issue
This error appears when using:
nextra@4.6.x
nextra-theme-docs@4.6.x
zod@4.4.x
Next.js App Router (especially with MDX routes)
Error:
This issue is still reproducible in some environments even with:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After spending hours debugging this issue, I found this PR #4990 that helped me understand and fix the root cause. However, even after the fix was merged, the issue still seems to persist in some environments.
Issue
This error appears when using:
nextra@4.6.xnextra-theme-docs@4.6.xzod@4.4.xError:
This issue is still reproducible in some environments even with:
Root cause
Nextra's Layout component validates props using Zod:
However,
childrenis destructured before validation:({ children, ...themeConfig } = props)So
childrenis NOT included in the object passed to Zod.With Zod 4.4.x, missing required keys now throw BEFORE custom validation runs, resulting in:
This is caused by stricter validation behavior in Zod 4.4 combined with Nextra's prop handling.
Temporary workaround (manual fix)
Until an official fix is fully available, the schema input must include children.
File location:
Change:
To:
Persistent fix (recommended)
For pnpm projects, you can persist this fix using the patch workflow:
Then edit
Apply the same fix:
Finally commit the patch:
This ensures the fix survives reinstallations and CI/CD environments.
Beta Was this translation helpful? Give feedback.
All reactions