# Error: Static generation timed out after 60 seconds for path '/[slug]'. Consider increasing the static generation timeout or reducing the number of static paths.

- **ID:** `nextjs/static-generation-buffer-timeout`
- **Domain:** nextjs
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Next.js has a default 60-second timeout for generating static pages during build. If generateStaticParams returns many paths or the page component has slow data fetching, the build may exceed this limit.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 13.4.0 | active | — | — |
| 13.5.0 | active | — | — |
| 14.0.0 | active | — | — |
| 14.1.0 | active | — | — |
| 14.2.0 | active | — | — |
| 15.0.0 | active | — | — |

## Workarounds

1. **Increase the static generation timeout in next.config.js: module.exports = { staticPageGenerationTimeout: 120 }; (value in seconds). This gives more time for complex builds.** (85% success)
   ```
   Increase the static generation timeout in next.config.js: module.exports = { staticPageGenerationTimeout: 120 }; (value in seconds). This gives more time for complex builds.
   ```
2. **Optimize generateStaticParams by batching API calls, implementing caching, or using incremental static regeneration (ISR) with revalidate option to reduce the number of paths generated at build time. Example: export async function generateStaticParams() { const slugs = await fetch('/api/slugs?limit=100'); return slugs.map(s => ({ slug: s })); }** (80% success)
   ```
   Optimize generateStaticParams by batching API calls, implementing caching, or using incremental static regeneration (ISR) with revalidate option to reduce the number of paths generated at build time. Example: export async function generateStaticParams() { const slugs = await fetch('/api/slugs?limit=100'); return slugs.map(s => ({ slug: s })); }
   ```
3. **Use dynamicParams: false in the page component to ensure only explicitly returned paths are pre-rendered, and fall back to dynamic rendering for others.** (75% success)
   ```
   Use dynamicParams: false in the page component to ensure only explicitly returned paths are pre-rendered, and fall back to dynamic rendering for others.
   ```

## Dead Ends

- **Setting generateStaticParams to return an empty array to avoid the timeout** — This defeats the purpose of static generation; all pages will be dynamically rendered at request time, losing performance benefits. (20% fail)
- **Adding console.log statements inside generateStaticParams to debug, which adds overhead and makes the timeout worse** — Logging increases I/O and slows down the generation process, potentially causing more timeouts. (50% fail)
