moeru-ai/airi · error · Error

Missing value for --settle-ms.

Error message

Missing value for --settle-ms.

What it means

Thrown by the capture script when the `--settle-ms` flag is present but has no following value. `--settle-ms` controls how long the script waits for the page to settle (animations, async data) before taking the screenshot; an empty/missing next token is rejected before capture begins.

Source

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

    filePath: derivedFilePath,
    format: 'avif',
  }
}

if (!['png', 'avif'].includes(requestedFormat)) {
  throw new Error(`Unsupported capture format "${requestedFormat}". Expected "png" or "avif".`)
}

if (!routePath?.startsWith('/')) {
  throw new Error(`Unsupported route path "${routePath}". Route paths must start with "/".`)
}

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

View on GitHub (pinned to 27111382b4)

Solutions

  1. Provide an integer millisecond value immediately after `--settle-ms`, e.g. `--settle-ms 500`.
  2. If sourced from a variable, validate it is a non-empty numeric string before invoking.
  3. Quote the value and ensure no trailing-space/empty-token issues.
  4. Re-run with the value present and confirm the flag is not the last token.

Example fix

// before
node scripts/capture.ts --route / --settle-ms

// after
node scripts/capture.ts --route / --settle-ms 500
Defensive patterns

Strategy: validation

Validate before calling

function getValue(flags: string[], name: string): string | undefined {
  const i = flags.indexOf(name)
  return i >= 0 ? flags[i + 1] : undefined
}
const settleMs = getValue(argv, '--settle-ms')
if (!settleMs || !/^\d+$/.test(settleMs)) {
  throw new Error('--settle-ms requires a positive integer value')
}

Type guard

function hasFlagValue(flags: string[], name: string): boolean {
  const i = flags.indexOf(name)
  return i >= 0 && Boolean(flags[i + 1])
}

Prevention

When it happens

Trigger: Invoking the capture script with `--settle-ms` as the last argument, or with `--settle-ms ''`, or where shell expansion produced an empty value. The guard checks `argv[settleMsFlagIndex + 1]` is truthy.

Common situations: Truncated copy-pasted commands; unset environment variable expanding to empty; flag placed at end of line; quoting mistakes around a numeric value.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/3807f04adefd9d83. Report an issue: GitHub.