---
title: "Invalid route segment config (next/segment-config)"
description: "Next.js reads `dynamic`, `revalidate`, `runtime`, `fetchCache`, `dynamicParams`, `preferredRegion` and `maxDuration` statically from page/layout/route files and only accepts literal values from a fixed set; with cacheComponents enabled, dynamic/revalidate/fetchCache are rejected."
url: http://localhost:4173/rules/next/segment-config
updated: 2026-11-11
---

# Invalid route segment config

> `next/segment-config` is a vetd rule. It flags: Invalid route segment config. It runs on every `check`, together with the TypeScript check.

| Fact | Value |
| --- | --- |
| Rule id | `next/segment-config` |
| Severity | error or warning |
| Group | Server and client boundaries |
| Tags | nextjs-16, correctness, performance |

## Why it matters

Next.js reads `dynamic`, `revalidate`, `runtime`, `fetchCache`, `dynamicParams`, `preferredRegion` and `maxDuration` statically from page/layout/route files and only accepts literal values from a fixed set; with cacheComponents enabled, dynamic/revalidate/fetchCache are rejected.

## How to fix it

Use one of the allowed literal values, or switch to "use cache" with cacheComponents.

## Credit

Based on work by:

- [Next.js team](https://nextjs.org): Route segment config options are read statically and only accept literal values; Cache Components replaces dynamic, revalidate and fetchCache with 'use cache'.

## References

- [Route Segment Config](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config), Next.js
- [cacheComponents](https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents), Next.js
- [use cache](https://nextjs.org/docs/app/api-reference/directives/use-cache), Next.js

## See it

Demos in the vetd Lab:

- ['use cache' and cacheLife](http://localhost:4173/lab/nextjs/use-cache-and-cachelife)

## Related rules

- [`next/revalidate-tag-profile`](http://localhost:4173/rules/next/revalidate-tag-profile.md)

## Get this text from vetd

MCP: call `explain` with `{ "diagnosticId": "next/segment-config" }`. CLI: `npx vetd explain next/segment-config`.

---

[All 92 rules](http://localhost:4173/rules.md) · Previous: [`next/async-client-component`](http://localhost:4173/rules/next/async-client-component.md) · Next: [`next/parallel-route-default`](http://localhost:4173/rules/next/parallel-route-default.md)
