moeru-ai/airi · error · Error
Missing value for --output-dir.
Error message
Missing value for --output-dir.
What it means
Thrown by the capture script when the `--output-dir` flag is present in argv but has no following value. The script detects the flag by index and expects `argv[index + 1]` to hold the directory path; an empty/missing next token fails the guard before capture runs.
Source
Thrown at packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts:67
await rm(artifact.filePath, { force: true })
return {
...artifact,
filePath: derivedFilePath,
format: 'avif',
}
}
if (!['png', 'avif'].includes(requestedFormat)) {
throw new Error(`Unsupported capture format "${requestedFormat}". Expected "png" or "avif".`)
}
if (!routePath?.startsWith('/')) {
throw new Error(`Unsupported route path "${routePath}". Route paths must start with "/".`)
}
if (outputDirFlagIndex >= 0 && !argv[outputDirFlagIndex + 1]) {
throw new Error('Missing value for --output-dir.')
}
if (settleMsFlagIndex >= 0 && !argv[settleMsFlagIndex + 1]) {
throw new Error('Missing value for --settle-ms.')
}
if (avifMaxWidthFlagIndex >= 0 && !argv[avifMaxWidthFlagIndex + 1]) {
throw new Error('Missing value for --avif-max-width.')
}
if (avifQualityFlagIndex >= 0 && !argv[avifQualityFlagIndex + 1]) {
throw new Error('Missing value for --avif-quality.')
}
if (avifSpeedFlagIndex >= 0 && !argv[avifSpeedFlagIndex + 1]) {
throw new Error('Missing value for --avif-speed.')
}
View on GitHub (pinned to 27111382b4)
Solutions
- Provide a non-empty directory path immediately after `--output-dir`, e.g. `--output-dir ./shots`.
- If the value comes from a variable, ensure it is set and non-empty before invoking the script (fail the wrapper early with a clear message).
- Quote the value to avoid shell splitting/quoting issues.
- Re-run with the full command and verify the token follows the flag.
Example fix
// before node scripts/capture.ts --route / --output-dir // after node scripts/capture.ts --route / --output-dir ./shots
Defensive patterns
Strategy: validation
Validate before calling
function getValue(flags: string[], name: string): string | undefined {
const i = flags.indexOf(name)
return i >= 0 ? flags[i + 1] : undefined
}
const outputDir = getValue(argv, '--output-dir')
if (!outputDir) throw new Error('--output-dir requires a non-empty value') Type guard
function hasFlagValue(flags: string[], name: string): boolean {
const i = flags.indexOf(name)
return i >= 0 && Boolean(flags[i + 1])
} Prevention
- Always provide a non-empty value immediately after --output-dir.
- If sourcing the value from a variable, assert it is non-empty before invoking the script.
- Quote the value to avoid shell splitting/quoting issues.
- Avoid placing value-bearing flags at the end of the command line.
When it happens
Trigger: Invoking the capture script with `--output-dir` as the last argument, or with `--output-dir ''` (empty string), or with the flag separated from its value by a shell quoting error. Any case where the token immediately after the flag is falsy triggers it.
Common situations: Copy-pasted commands that truncate the value; shell variable expansion that yields an empty string (e.g. `$OUT_DIR` unset); flag placed at the end of the command line.
Related errors
- Missing value for --settle-ms.
- Unsupported capture format "${requestedFormat}". Expected "p
- Unsupported route path "${routePath}". Route paths must star
- cap-vite [vite args...] -- <ios|android> [cap run args...]
- Missing value for `${optionName}`.
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/2e2f335344d64169.
Report an issue: GitHub.