vercel/next.js · error

Cannot reliably include an `ImageResponse` option of type `$

Error message

Cannot reliably include an `ImageResponse` option of type `${typeName}` in the cache key, so different images may collide and return an incorrect cached result. Please report this to the Next.js team.

What it means

Error "Cannot reliably include an `ImageResponse` option of type `${typeName}` in the cache key, so different images may collide and return an incorrect cached result. Please report this to the Next.js team." thrown in vercel/next.js.

Source

Thrown at packages/next/src/server/og/cache-image-response.ts:357

    for (const item of value) {
      updateHashWithOptions(hash, item)
    }
    return
  }

  // The key walk below captures a plain object faithfully, but an exotic object
  // keeps its state elsewhere (a `Map`'s/`Set`'s entries, a `Date`'s time), so
  // two different values would hash the same and could return the wrong cached
  // image. This shouldn't happen for `ImageResponse` options, so we warn rather
  // than fail, then hash best-effort, so it can be reported. Not gated on
  // `NODE_ENV`: this runs during the production `next build` prerender, where
  // the warning is most useful.
  const prototype = Object.getPrototypeOf(value)
  if (prototype !== Object.prototype && prototype !== null) {
    const typeName =
      (value as { constructor?: { name?: string } }).constructor?.name ??
      'object'
    console.warn(
      `Cannot reliably include an \`ImageResponse\` option of type ` +
        `\`${typeName}\` in the cache key, so different images may collide and ` +
        `return an incorrect cached result. Please report this to the Next.js ` +
        `team.`
    )
  }

  const keys = Object.keys(value).sort()
  hash.update(`{${keys.length},`)
  for (const key of keys) {
    updateHashWithBytes(hash, 'k', Buffer.from(key))
    updateHashWithOptions(hash, (value as Record<string, unknown>)[key])
  }
}

/**
 * Hashes a length-prefixed, tagged byte run: `<tag><byteLength>:<bytes>`. The
 * length prefix keeps the run self-delimiting so it can't blend into adjacent

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Pass only JSON-serializable options to ImageResponse, or report the issue to the Next.js team.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/next/src/server/og/cache-image-response.ts:357 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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