{"record":{"id":"88234412932e742c","repo":"moeru-ai/airi","slug":"unsupported-avif-speed-argv-avifspeedflagindex","errorCode":null,"errorMessage":"Unsupported AVIF speed \"${argv[avifSpeedFlagIndex + 1] ?? avifSpeed}\". Expected a number between 1 and 10.","messagePattern":"Unsupported AVIF speed \"(.+?)\"\\. Expected a number between 1 and 10\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":99,"sourceCode":"\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,\n  },\n})\n","sourceCodeStart":81,"sourceCodeEnd":116,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L81-L116","documentation":"The value of --avif-speed is coerced with Number() (capture.ts:28) and must be a finite number in the 1-10 range (capture.ts:99) before being handed to @napi-rs/image Transformer.avif({ speed }) (capture.ts:43-46). This error fires on NaN, values below 1, or values above 10; note this is the encoder speed scale (1 = slowest/best, 10 = fastest), not a percentage.","triggerScenarios":"Passing `--avif-speed fast`, `--avif-speed 0`, `--avif-speed 11`, or `--avif-speed 100` (percentage-style input). A dangling flag token in the value slot also produces NaN.","commonSituations":"Assuming speed is 0-1 or 0-100 like other tools, or copying speed values from ffmpeg/cavif presets whose scales differ.","solutions":["Pass an integer 1-10: `--avif-speed 6`","Map qualitative presets yourself (fast=8, balanced=6, best=2) instead of words","Validate the value in the caller before building the command line"],"exampleFix":"// before\npnpm capture --format avif --avif-speed 100\n// after\npnpm capture --format avif --avif-speed 6","handlingStrategy":"validation","validationCode":"function parseAvifSpeed(raw: string | undefined): number {\n  const value = raw === undefined ? 6 : Number(raw)\n  if (!Number.isFinite(value) || value < 1 || value > 10)\n    throw new Error(`Unsupported AVIF speed \"${raw}\". Expected a number between 1 and 10.`)\n  return value\n}","typeGuard":"const isEncoderSpeed = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 1 && v <= 10","tryCatchPattern":null,"preventionTips":["The napi-rs AVIF speed range is 1-10 (1 slowest/best, 10 fastest)","Do not reuse speed scales from other encoders","Fail fast on NaN in pipeline config validation"],"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"}