vercel/next.js · error
Warning: invalid tags passed to ${description}:
Error message
Warning: invalid tags passed to ${description}: What it means
validateTags collects tags that are non-strings or exceed NEXT_CACHE_TAG_MAX_LENGTH and warns with this message, then logs each invalid tag with its reason; invalid tags are excluded from revalidation tagging rather than failing the fetch.
Source
Thrown at packages/next/src/server/lib/patch-fetch.ts:162
})
} else {
// Encode so a non-ASCII tag can be safely serialized into the
// `x-next-cache-tags` HTTP header without tripping Node's header
// validation. Length is checked on the raw input above.
validTags.push(encodeHeaderSafe(tag))
}
if (validTags.length > NEXT_CACHE_TAG_MAX_ITEMS) {
console.warn(
`Warning: exceeded max tag count for ${description}, dropped tags:`,
tags.slice(i).join(', ')
)
break
}
}
if (invalidTags.length > 0) {
console.warn(`Warning: invalid tags passed to ${description}: `)
for (const { tag, reason } of invalidTags) {
console.log(`tag: "${tag}" ${reason}`)
}
}
return validTags
}
function trackFetchMetric(
workStore: WorkStore,
span: Span | undefined,
ctx: Omit<FetchMetric, 'end' | 'idx'>
) {
const metric = {
...ctx,
end: performance.timeOrigin + performance.now(),
idx: workStore.nextFetchId || 0,
}View on GitHub (pinned to 0eb3775416)
Solutions
- Pass only valid cache tag strings (no invalid characters, within length limits) to fetch/revalidate.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/next/src/server/lib/patch-fetch.ts:162 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/58b4ce7da7d35994.
Report an issue: GitHub.