{"record":{"id":"2e2f335344d64169","repo":"moeru-ai/airi","slug":"missing-value-for-output-dir","errorCode":null,"errorMessage":"Missing value for --output-dir.","messagePattern":"Missing value for --output-dir\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":67,"sourceCode":"  await rm(artifact.filePath, { force: true })\n\n  return {\n    ...artifact,\n    filePath: derivedFilePath,\n    format: 'avif',\n  }\n}\n\nif (!['png', 'avif'].includes(requestedFormat)) {\n  throw new Error(`Unsupported capture format \"${requestedFormat}\". Expected \"png\" or \"avif\".`)\n}\n\nif (!routePath?.startsWith('/')) {\n  throw new Error(`Unsupported route path \"${routePath}\". Route paths must start with \"/\".`)\n}\n\nif (outputDirFlagIndex >= 0 && !argv[outputDirFlagIndex + 1]) {\n  throw new Error('Missing value for --output-dir.')\n}\n\nif (settleMsFlagIndex >= 0 && !argv[settleMsFlagIndex + 1]) {\n  throw new Error('Missing value for --settle-ms.')\n}\n\nif (avifMaxWidthFlagIndex >= 0 && !argv[avifMaxWidthFlagIndex + 1]) {\n  throw new Error('Missing value for --avif-max-width.')\n}\n\nif (avifQualityFlagIndex >= 0 && !argv[avifQualityFlagIndex + 1]) {\n  throw new Error('Missing value for --avif-quality.')\n}\n\nif (avifSpeedFlagIndex >= 0 && !argv[avifSpeedFlagIndex + 1]) {\n  throw new Error('Missing value for --avif-speed.')\n}\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L49-L85","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnode scripts/capture.ts --route / --output-dir\n\n// after\nnode scripts/capture.ts --route / --output-dir ./shots","handlingStrategy":"validation","validationCode":"function getValue(flags: string[], name: string): string | undefined {\n  const i = flags.indexOf(name)\n  return i >= 0 ? flags[i + 1] : undefined\n}\nconst outputDir = getValue(argv, '--output-dir')\nif (!outputDir) throw new Error('--output-dir requires a non-empty value')","typeGuard":"function hasFlagValue(flags: string[], name: string): boolean {\n  const i = flags.indexOf(name)\n  return i >= 0 && Boolean(flags[i + 1])\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["capture-script","cli","validation","arguments"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}