vercel/next.js · error · Error

Pass `Infinity` instead of `false` if you want to cache on t

Error message

Pass `Infinity` instead of `false` if you want to cache on the server forever without checking with the origin.

What it means

Value normalization in normalizeCacheLifeValue: the expire key of a cacheLife profile was set to false. Server-cache expiry must be a duration; the error tells the user to pass Infinity when the intent is to cache on the server indefinitely without origin checks.

Source

Thrown at packages/next/src/server/use-cache/cache-life-profile.ts:39

  value: unknown,
  context: CacheLifeProfileContext
): number | undefined {
  if (value === undefined) {
    return undefined
  }

  if (value === false) {
    if (key === 'stale') {
      throw new Error(
        'Pass `Infinity` instead of `false` if you want to cache on the client forever ' +
          'without checking with the server.'
      )
    } else if (key === 'revalidate') {
      throw new Error(
        'Pass `Infinity` instead of `false` if you do not want to revalidate by time.'
      )
    } else {
      throw new Error(
        'Pass `Infinity` instead of `false` if you want to cache on the server forever ' +
          'without checking with the origin.'
      )
    }
  }

  if (typeof value !== 'number') {
    throw new Error(`The ${key} option must be a number of seconds.`)
  }

  if (value === Infinity) {
    // Infinity means "never", but turns into null when serialized as JSON
    // (e.g. for build workers or cache handlers), unlike INFINITE_CACHE.
    return INFINITE_CACHE
  }

  if (!Number.isFinite(value)) {
    throw new Error(

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Use Infinity instead of false for the cacheLife expire value.
Defensive patterns

Strategy: validation

When it happens

Trigger: A cacheLife expire value of false is configured.

Common situations: Use Infinity instead of false for infinite server-side cache in cacheLife profiles.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/393245417bab0212. Report an issue: GitHub.