moeru-ai/airi · error · Error
Missing value for --output-dir.
Error message
Missing value for --output-dir.
What it means
The stage-tamagotchi-browser capture script parses process.argv by hand: it locates --output-dir with argv.findIndex (capture.ts:18) and resolves the directory from argv[index + 1] (capture.ts:29-31). This error means the flag token was present but the slot right after it was undefined or an empty string, so no output directory can be resolved. The script intentionally refuses to silently fall back to the default 'artifacts/final' when the user explicitly names the flag.
Solutions
- Append a value after the flag: `--output-dir artifacts/final` (relative paths are resolved against the scene app root via path.resolve)
- Omit the flag entirely to get the default `<cwd>/artifacts/final`
- If the value comes from a variable, default it in the command: `--output-dir "${OUT_DIR:-artifacts/final}"`
Example fix
// before pnpm capture --route /docs/setup-and-use --output-dir // after pnpm capture --route /docs/setup-and-use --output-dir artifacts/final
Defensive patterns
Strategy: validation
Validate before calling
// Run before invoking the capture script
function requireFlagValue(argv: string[], flag: string): string | undefined {
const i = argv.indexOf(flag)
if (i === -1) return undefined // flag absent, default applies
const value = argv[i + 1]
if (!value) throw new Error(`Missing value for ${flag}.`)
return value
}
requireFlagValue(process.argv, '--output-dir') Prevention
- Never append a value-taking flag without its value; build argv from a validated options object
- Default empty variables inline in CI: `--output-dir "${OUT_DIR:-artifacts/final}"`
- Smoke-test capture commands in CI with the exact flag set production uses
When it happens
Trigger: Running the script with --output-dir as the last token (e.g. `tsx scripts/capture.ts --route / --output-dir`), passing an explicit empty string (`--output-dir ""`), or a CI step / shell wrapper that appends the flag without its value.
Common situations: Shell scripts that conditionally append flags from possibly-empty variables (`--output-dir "$OUT_DIR"` with OUT_DIR unset), shared CI command templates where the path argument gets dropped, or a typo that places the path before the flag.
Related errors
- Missing value for --avif-max-width.
- Missing value for --avif-quality.
- Missing value for --avif-speed.
- Missing value for --settle-ms.
- Unsupported AVIF max width
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/2e2f335344d64169.
Report an issue: GitHub.
Appendix: 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 677329427f)