moeru-ai/airi · error · Error

Missing value for --avif-speed.

Error message

Missing value for --avif-speed.

What it means

The capture script reads --avif-speed from argv[avifSpeedFlagIndex + 1] (capture.ts:22,28) and passes it into Transformer.avif({ speed }) (capture.ts:43-46), where 1 is slowest/best compression and 10 is fastest. This error fires when the flag is present but the next argv slot is undefined or empty, so the speed value (default 6) cannot be read; the 1-10 range is enforced separately at capture.ts:99.

Source

Thrown at packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts:83

if (outputDirFlagIndex >= 0 && !argv[outputDirFlagIndex + 1]) {
  throw new Error('Missing value for --output-dir.')
}

if (settleMsFlagIndex >= 0 && !argv[settleMsFlagIndex + 1]) {
  throw new Error('Missing value for --settle-ms.')
}

if (avifMaxWidthFlagIndex >= 0 && !argv[avifMaxWidthFlagIndex + 1]) {
  throw new Error('Missing value for --avif-max-width.')
}

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.`)
}

View on GitHub (pinned to 677329427f)

Solutions

  1. Provide a speed between 1 and 10: `--avif-speed 6`
  2. Omit the flag to keep the default 6
  3. Build AVIF flags from a validated options object so empty values never reach argv

Example fix

// before
pnpm capture --format avif --avif-speed
// after
pnpm capture --format avif --avif-speed 6
Defensive patterns

Strategy: validation

Validate before calling

const i = argv.indexOf('--avif-speed')
if (i >= 0 && !argv[i + 1])
  throw new Error('Missing value for --avif-speed.')

Prevention

When it happens

Trigger: Passing --avif-speed as the last token of an AVIF capture command, or with an empty string value.

Common situations: Speed/quality tuning scripts where the speed variable is left unset, or command templates whose optional flag list ends with a dangling --avif-speed.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/684e20a9048864f6. Report an issue: GitHub.