{"record":{"id":"58ba918ac719b71f","repo":"moeru-ai/airi","slug":"unsupported-avif-max-width-argv-avifmaxwidthfla","errorCode":null,"errorMessage":"Unsupported AVIF max width \"${argv[avifMaxWidthFlagIndex + 1] ?? avifMaxWidth}\". Expected a number >= 1.","messagePattern":"Unsupported AVIF max width \"(.+?)\"\\. Expected a number >= 1\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":91,"sourceCode":"\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\nif (!Number.isFinite(avifQuality) || avifQuality < 0 || avifQuality > 100) {\n  throw new Error(`Unsupported AVIF quality \"${argv[avifQualityFlagIndex + 1] ?? avifQuality}\". Expected a number between 0 and 100.`)\n}\n\nif (!Number.isFinite(avifSpeed) || avifSpeed < 1 || avifSpeed > 10) {\n  throw new Error(`Unsupported AVIF speed \"${argv[avifSpeedFlagIndex + 1] ?? avifSpeed}\". Expected a number between 1 and 10.`)\n}\n\nawait captureBrowserRoots({\n  imageTransformers: requestedFormat === 'avif'\n    ? [avifTransformer]\n    : undefined,\n  sceneAppRoot,\n  routePath,\n  outputDir,\n  settleMs,","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L73-L109","documentation":"The value of --avif-max-width is coerced with Number() (capture.ts:26) and must be a finite number >= 1 (capture.ts:91) because avifTransformer uses it as the target pixel width for downscaling (capture.ts:38-41). This error fires when the string is non-numeric or less than 1, echoing the offending raw value in the message.","triggerScenarios":"Passing `--avif-max-width auto`, `--avif-max-width 0`, a negative number, or another flag token where the value should be (which coerces to NaN).","commonSituations":"Copy-pasting CSS-like or human values (`100%`, `auto`, `1x`) from design specs into a CLI that expects pixels; zero entered to mean 'no limit' when the script treats 0 as invalid.","solutions":["Pass a positive pixel width: `--avif-max-width 1200`","To keep full resolution, pass the actual capture width (e.g. 1920) instead of 0","Verify no stray flag or empty string follows --avif-max-width"],"exampleFix":"// before\npnpm capture --format avif --avif-max-width auto\n// after\npnpm capture --format avif --avif-max-width 1200","handlingStrategy":"validation","validationCode":"function parseAvifMaxWidth(raw: string | undefined): number {\n  const value = raw === undefined ? 1200 : Number(raw)\n  if (!Number.isFinite(value) || value < 1)\n    throw new Error(`Unsupported AVIF max width \"${raw}\". Expected a number >= 1.`)\n  return value\n}","typeGuard":"const isPositiveInt = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && Number.isInteger(v) && v >= 1","tryCatchPattern":null,"preventionTips":["Use positive pixel integers only; 0 is invalid, use the real capture width instead","Never pass CSS-like values (auto, 100%, 1x)","Range-check the variable in CI config before building the command"],"tags":["cli","argv","avif","nan","vishot","capture"],"backgroundTag":"invalid-cli-argument-value","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}