moeru-ai/airi · error · Error
Unsupported AVIF quality "${argv[avifQualityFlagIndex + 1] ?
Error message
Unsupported AVIF quality "${argv[avifQualityFlagIndex + 1] ?? avifQuality}". Expected a number between 0 and 100. What it means
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.
Source
Thrown at packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts:95
if (avifQualityFlagIndex >= 0 && !argv[avifQualityFlagIndex + 1]) {
throw new Error('Missing value for --avif-quality.')
}
if (avifSpeedFlagIndex >= 0 && !argv[avifSpeedFlagIndex + 1]) {
throw new Error('Missing value for --avif-speed.')
}
if (!Number.isFinite(settleMs) || settleMs < 0) {
throw new Error(`Unsupported settle delay "${argv[settleMsFlagIndex + 1] ?? settleMs}". Expected a number >= 0.`)
}
if (!Number.isFinite(avifMaxWidth) || avifMaxWidth < 1) {
throw new Error(`Unsupported AVIF max width "${argv[avifMaxWidthFlagIndex + 1] ?? avifMaxWidth}". Expected a number >= 1.`)
}
if (!Number.isFinite(avifQuality) || avifQuality < 0 || avifQuality > 100) {
throw new Error(`Unsupported AVIF quality "${argv[avifQualityFlagIndex + 1] ?? avifQuality}". Expected a number between 0 and 100.`)
}
if (!Number.isFinite(avifSpeed) || avifSpeed < 1 || avifSpeed > 10) {
throw new Error(`Unsupported AVIF speed "${argv[avifSpeedFlagIndex + 1] ?? avifSpeed}". Expected a number between 1 and 10.`)
}
await captureBrowserRoots({
imageTransformers: requestedFormat === 'avif'
? [avifTransformer]
: undefined,
sceneAppRoot,
routePath,
outputDir,
settleMs,
viewport: {
width: 1920,
height: 1080,
deviceScaleFactor: 2,View on GitHub (pinned to 677329427f)
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
Example fix
// before pnpm capture --format avif --avif-quality high // after pnpm capture --format avif --avif-quality 35
Defensive patterns
Strategy: validation
Validate before calling
function parseAvifQuality(raw: string | undefined): number {
const value = raw === undefined ? 35 : Number(raw)
if (!Number.isFinite(value) || value < 0 || value > 100)
throw new Error(`Unsupported AVIF quality "${raw}". Expected a number between 0 and 100.`)
return value
} Type guard
const isPercentScale = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 100
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported AVIF speed "${argv[avifSpeedFlagIndex + 1] ?? av
- Unsupported AVIF max width "${argv[avifMaxWidthFlagIndex + 1
- Missing value for --avif-max-width.
- Missing value for --avif-quality.
- Missing value for --avif-speed.
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/8c27d10b2817ee71.
Report an issue: GitHub.