nextjs
config_error
ai_generated
true
Error: Invalid segment config export. Only 'dynamic', 'dynamicParams', 'revalidate', 'fetchCache', 'runtime', 'preferredRegion', 'maxDuration' are allowed.
ID: nextjs/invalid-segment-config-export
90%Fix Rate
88%Confidence
1Evidence
2023-11-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Next.js 13.x | active | — | — | — |
| Next.js 14.x | active | — | — | — |
| Next.js 15.x | active | — | — | — |
Root Cause
A page or layout exports a config object with an unsupported key (e.g., 'generateStaticParams' as a config key instead of a function, or a misspelled config name).
generic中文
页面或布局导出了一个包含不受支持的键的配置对象(例如,将 'generateStaticParams' 作为配置键而不是函数,或拼写错误的配置名称)。
Official Documentation
https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-configWorkarounds
-
95% success Check the exported config object for any keys not in the allowed list. Remove or correct them. Ensure generateStaticParams is exported as a separate function, not inside the config.
Check the exported config object for any keys not in the allowed list. Remove or correct them. Ensure generateStaticParams is exported as a separate function, not inside the config.
-
90% success Use the official Next.js segment config documentation to verify allowed keys and correct spelling. If using TypeScript, define the config with a typed interface to catch errors at compile time.
Use the official Next.js segment config documentation to verify allowed keys and correct spelling. If using TypeScript, define the config with a typed interface to catch errors at compile time.
中文步骤
Check the exported config object for any keys not in the allowed list. Remove or correct them. Ensure generateStaticParams is exported as a separate function, not inside the config.
Use the official Next.js segment config documentation to verify allowed keys and correct spelling. If using TypeScript, define the config with a typed interface to catch errors at compile time.
Dead Ends
Common approaches that don't work:
-
80% fail
generateStaticParams is a separate exported function, not a config key. It must be exported directly from the page file.
-
50% fail
Even if the key is valid, the value must be supported; 'edge' requires specific configuration and may not be available in all deployments.
-
90% fail
The framework validates config keys strictly; any unrecognized key triggers this error.