vercel/next.js · error
Invalid --scenario value: ${scenarioRaw}. Use e2e|minimal-se
Error message
Invalid --scenario value: ${scenarioRaw}. Use e2e|minimal-server What it means
Thrown by parseCli (benchmark.ts:206) when --scenario is something other than 'e2e' or 'minimal-server' (the default is 'e2e'). These two scenarios select entirely different server setups: e2e runs a real `next build` + `next start`, minimal-server runs NextServer with minimalMode and no router-server against bench/next-minimal-server. Any other value is meaningless and rejected up front.
Source
Thrown at bench/render-pipeline/benchmark.ts:206
if (rawArgs.includes('--help')) {
usage()
process.exit(0)
}
const args = new Map<string, string>()
for (const rawArg of rawArgs) {
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')
View on GitHub (pinned to 0ae8c72462)
Solutions
- Use exactly e2e or minimal-server: --scenario=e2e (default) or --scenario=minimal-server.
- Spell minimal-server in full; there is no short alias.
- Run with --help to see current valid values.
- If you need a new scenario, add it to the Scenario type and the branch in main(); don't bypass the check.
Example fix
# before # pnpm bench:render-pipeline --scenario=minimal # after # pnpm bench:render-pipeline --scenario=minimal-server
Defensive patterns
Strategy: validation
Validate before calling
const VALID_SCENARIOS = new Set(['e2e', 'minimal-server'])
function parseScenario(raw: string | undefined): 'e2e' | 'minimal-server' {
const s = raw ?? 'e2e'
if (!VALID_SCENARIOS.has(s)) throw new Error(`--scenario must be one of ${[...VALID_SCENARIOS].join('|')}`)
return s as 'e2e' | 'minimal-server'
} Type guard
function isValidScenario(s: string): s is 'e2e' | 'minimal-server' {
return s === 'e2e' || s === 'minimal-server'
} Try / catch
try {
const scenario = parseScenario(args.get('scenario'))
} catch (err) {
console.error((err as Error).message, '\nValid scenarios: e2e | minimal-server')
process.exit(2)
} Prevention
- Use exactly 'e2e' or 'minimal-server'; spell minimal-server in full.
- Omit the flag to get the default (e2e).
- Run --help to confirm accepted values.
- Update VALID_SCENARIOS and the Scenario type together when adding a scenario.
When it happens
Trigger: Passing --scenario=edge, --scenario=production, --scenario=node, or a typo like --scenario=minimal (missing -server). A bare --scenario resolves to 'true' which also fails.
Common situations: Guessing scenario names; copy from docs that referenced an old/renamed scenario; truncating 'minimal-server' to 'minimal'.
Related errors
- Invalid numeric value for --${key}: ${value}
- --routes cannot be empty
- Each route must start with '/': ${route}
- Invalid --stream-mode value: ${streamModeRaw}. Use node
- Invalid --top value: ${topRaw}
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/0c0cf952c200f383.
Report an issue: GitHub.