{"record":{"id":"224e74930c4cb8e1","repo":"moeru-ai/airi","slug":"missing-value-for-avif-max-width","errorCode":null,"errorMessage":"Missing value for --avif-max-width.","messagePattern":"Missing value for --avif-max-width\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":75,"sourceCode":"\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\nif (!Number.isFinite(settleMs) || settleMs < 0) {\n  throw new Error(`Unsupported settle delay \"${argv[settleMsFlagIndex + 1] ?? settleMs}\". Expected a number >= 0.`)\n}\n\nif (!Number.isFinite(avifMaxWidth) || avifMaxWidth < 1) {\n  throw new Error(`Unsupported AVIF max width \"${argv[avifMaxWidthFlagIndex + 1] ?? avifMaxWidth}\". Expected a number >= 1.`)\n}\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L57-L93","documentation":"The capture script reads --avif-max-width from argv[avifMaxWidthFlagIndex + 1] (capture.ts:20,26); the value feeds avifTransformer, which downscales PNG artifacts wider than this before re-encoding to AVIF (capture.ts:38-41). This error fires when the flag is present but the next argv slot is undefined or empty, so the width (default 1200) cannot be read. Like the sibling checks, it is a fail-fast guard against half-specified CLI input.","triggerScenarios":"Passing --avif-max-width as the last token of the command, or with an empty-string value; typically only used together with `--format avif`.","commonSituations":"AVIF capture jobs in CI where the width variable is conditionally set, or command lines assembled by concatenating optional fragments that end with a dangling flag.","solutions":["Supply a positive pixel width: `--avif-max-width 1200`","Omit the flag to keep the default 1200","Only append AVIF flags when `--format avif` is actually requested, from a validated variable"],"exampleFix":"// before\npnpm capture --format avif --avif-max-width\n// after\npnpm capture --format avif --avif-max-width 1200","handlingStrategy":"validation","validationCode":"const i = argv.indexOf('--avif-max-width')\nif (i >= 0 && !argv[i + 1])\n  throw new Error('Missing value for --avif-max-width.')\n// only forward AVIF flags when --format avif is requested","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Group all --avif-* flags behind a single `format === 'avif'` condition","Pass pixel counts, not words or percentages","Validate numeric flags in the wrapper script before exec"],"tags":["cli","argv","avif","vishot","capture"],"backgroundTag":"missing-cli-argument-value","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}