vercel/next.js · error

Invalid --stream-mode value: ${streamModeRaw}. Use node

Error message

Invalid --stream-mode value: ${streamModeRaw}. Use node

What it means

Thrown by parseCli (benchmark.ts:213) when --stream-mode is anything other than 'node' (the default). The StreamMode type is currently just 'node' and the benchmark only implements the Node.js streaming path; other stream modes (e.g. a future edge/web-streams variant) are not wired up, so any other value is rejected to avoid silently benchmarking the wrong thing.

Source

Thrown at bench/render-pipeline/benchmark.ts:213

    if (!rawArg.startsWith('--')) continue
    const eq = rawArg.indexOf('=')
    if (eq === -1) {
      args.set(rawArg.slice(2), 'true')
    } else {
      args.set(rawArg.slice(2, eq), rawArg.slice(eq + 1))
    }
  }

  const scenarioRaw = args.get('scenario') ?? 'e2e'
  if (scenarioRaw !== 'minimal-server' && scenarioRaw !== 'e2e') {
    throw new Error(
      `Invalid --scenario value: ${scenarioRaw}. Use e2e|minimal-server`
    )
  }

  const streamModeRaw = args.get('stream-mode') ?? 'node'
  if (streamModeRaw !== 'node') {
    throw new Error(`Invalid --stream-mode value: ${streamModeRaw}. Use node`)
  }

  const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
  const artifactDir = resolve(
    REPO_ROOT,
    args.get('artifact-dir') ?? `bench/render-pipeline/artifacts/${timestamp}`
  )

  const routes = parseRoutes(args.get('routes'))
  const build = parseBoolean(args.get('build') ?? 'true')

  return {
    scenario: scenarioRaw,
    jsonOut: args.get('json-out'),

    appDir: resolve(REPO_ROOT, args.get('app-dir') ?? 'bench/basic-app'),
    routes,
    streamMode: streamModeRaw,

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Use --stream-mode=node (the only implemented mode) or simply omit the flag.
  2. Do not pass other values; if you need a different stream mode it must be implemented in the benchmark first.
  3. Run --help to confirm the accepted value.

Example fix

# before
#   pnpm bench:render-pipeline --stream-mode=edge

# after
#   pnpm bench:render-pipeline --stream-mode=node
# (or omit the flag entirely — node is the default)
Defensive patterns

Strategy: validation

Validate before calling

const VALID_STREAM_MODES = new Set(['node'])
function parseStreamMode(raw: string | undefined): 'node' {
  const m = raw ?? 'node'
  if (!VALID_STREAM_MODES.has(m)) throw new Error(`--stream-mode must be one of ${[...VALID_STREAM_MODES].join('|')}`)
  return m as 'node'
}

Type guard

function isValidStreamMode(s: string): s is 'node' {
  return s === 'node'
}

Try / catch

try {
  const streamMode = parseStreamMode(args.get('stream-mode'))
} catch (err) {
  console.error((err as Error).message, '\nCurrently only --stream-mode=node is implemented.')
  process.exit(2)
}

Prevention

When it happens

Trigger: Passing --stream-mode=edge, --stream-mode=web, or a bare --stream-mode (-> 'true'). The check is `if (streamModeRaw !== 'node')`, so literally anything other than 'node' fails, including the default when omitted is fine because the default IS 'node'.

Common situations: Assuming the benchmark supports the same stream modes as some other tool; passing --stream-mode=node explicitly is fine; anything else is not yet implemented.

Related errors


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