vercel/next.js · error · InstantValidationError

Expected sample param value for segment

Error message

Expected sample param value for segment '${rawSegment}' to be an array of strings, got ${typeof paramValue}

What it means

Type check while interpolating sample params into a route pathname for instant validation: a catchall or optional-catchall segment's param value in the samples config was expected to be an array of strings but had another type. The faulting input is the samples entry for that param in the route's validation config.

Solutions

  1. Provide an array of strings for catch-all sample params in instant validation config.
Defensive patterns

Strategy: validation

When it happens

Trigger: A catch-all sample param value is not an array of strings.

Common situations: Instant validation sample data provides a wrong type for a catch-all segment param.


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

Appendix: source

Thrown at packages/next/src/server/app-render/instant-validation/instant-samples.ts:430

 */
function createPathnameFromRouteAndSampleParams(route: string, params: Params) {
  let interpolatedSegments: string[] = []
  const rawSegments = route.split('/')
  for (const rawSegment of rawSegments) {
    const param = getSegmentParam(rawSegment)
    if (param) {
      switch (param.paramType) {
        case 'catchall':
        case 'optional-catchall': {
          let paramValue = params[param.paramName]
          if (paramValue === undefined) {
            // The value for the param was not provided. `usePathname` will detect this and throw
            // before this can surface to userspace. Use `[...NAME]` as a placeholder for the param value
            // in case it pops up somewhere unexpectedly.
            paramValue = [rawSegment]
          } else if (!Array.isArray(paramValue)) {
            // NOTE: this happens outside of render, so we don't need `trackMissingSampleErrorAndThrow`
            throw new InstantValidationError(
              `Expected sample param value for segment '${rawSegment}' to be an array of strings, got ${typeof paramValue}`
            )
          }
          interpolatedSegments.push(
            ...paramValue.map((v) => encodeURIComponent(v))
          )
          break
        }
        case 'dynamic': {
          let paramValue = params[param.paramName]
          if (paramValue === undefined) {
            // The value for the param was not provided. `usePathname` will detect this and throw
            // before this can surface to userspace. Use `[NAME]` as a placeholder for the param value
            // in case it pops up somewhere unexpectedly.
            paramValue = rawSegment
          } else if (typeof paramValue !== 'string') {
            // NOTE: this happens outside of render, so we don't need `trackMissingSampleErrorAndThrow`
            throw new InstantValidationError(

View on GitHub (pinned to 0eb3775416)