{"record":{"id":"8c27d10b2817ee71","repo":"moeru-ai/airi","slug":"unsupported-avif-quality-argv-avifqualityflagin","errorCode":null,"errorMessage":"Unsupported AVIF quality \"${argv[avifQualityFlagIndex + 1] ?? avifQuality}\". Expected a number between 0 and 100.","messagePattern":"Unsupported AVIF quality \"(.+?)\"\\. Expected a number between 0 and 100\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":95,"sourceCode":"\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,\n  viewport: {\n    width: 1920,\n    height: 1080,\n    deviceScaleFactor: 2,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L77-L113","documentation":"The value of --avif-quality is coerced with Number() (capture.ts:27) and must be a finite number in the inclusive 0-100 range (capture.ts:95) because it is forwarded to @napi-rs/image Transformer.avif({ quality }) (capture.ts:43-46). This error fires on NaN, negative values, or values above 100, echoing the raw string in the message.","triggerScenarios":"Passing `--avif-quality high`, `--avif-quality 101`, `--avif-quality -5`, or a percentage with a percent sign (`35%`). A following flag token also coerces to NaN.","commonSituations":"Treating quality as a 0-1 float (`0.8` parses but is not the failure; `0.8%` fails), mixing up quality with speed scales, or pasting values from other encoders that use 0-1 or 0-63 scales.","solutions":["Pass an integer between 0 and 100: `--avif-quality 35`","If migrating from a 0-1 scale, multiply by 100 and round","Strip units and validate numerically in the calling script before invoking capture"],"exampleFix":"// before\npnpm capture --format avif --avif-quality high\n// after\npnpm capture --format avif --avif-quality 35","handlingStrategy":"validation","validationCode":"function parseAvifQuality(raw: string | undefined): number {\n  const value = raw === undefined ? 35 : Number(raw)\n  if (!Number.isFinite(value) || value < 0 || value > 100)\n    throw new Error(`Unsupported AVIF quality \"${raw}\". Expected a number between 0 and 100.`)\n  return value\n}","typeGuard":"const isPercentScale = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 100","tryCatchPattern":null,"preventionTips":["The scale is 0-100; convert from 0-1 floats before passing","Strip '%' and whitespace in the caller","Validate all encoder knobs in one options object before invoking capture"],"tags":["cli","argv","avif","range","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-14T00:17:10.932Z"}