{"record":{"id":"3807f04adefd9d83","repo":"moeru-ai/airi","slug":"missing-value-for-settle-ms","errorCode":null,"errorMessage":"Missing value for --settle-ms.","messagePattern":"Missing value for --settle-ms\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":71,"sourceCode":"    filePath: derivedFilePath,\n    format: 'avif',\n  }\n}\n\nif (!['png', 'avif'].includes(requestedFormat)) {\n  throw new Error(`Unsupported capture format \"${requestedFormat}\". Expected \"png\" or \"avif\".`)\n}\n\nif (!routePath?.startsWith('/')) {\n  throw new Error(`Unsupported route path \"${routePath}\". Route paths must start with \"/\".`)\n}\n\nif (outputDirFlagIndex >= 0 && !argv[outputDirFlagIndex + 1]) {\n  throw new Error('Missing value for --output-dir.')\n}\n\nif (settleMsFlagIndex >= 0 && !argv[settleMsFlagIndex + 1]) {\n  throw new Error('Missing value for --settle-ms.')\n}\n\nif (avifMaxWidthFlagIndex >= 0 && !argv[avifMaxWidthFlagIndex + 1]) {\n  throw new Error('Missing value for --avif-max-width.')\n}\n\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","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"Truncated copy-pasted commands; unset environment variable expanding to empty; flag placed at end of line; quoting mistakes around a numeric value.","solutions":["Provide an integer millisecond value immediately after `--settle-ms`, e.g. `--settle-ms 500`.","If sourced from a variable, validate it is a non-empty numeric string before invoking.","Quote the value and ensure no trailing-space/empty-token issues.","Re-run with the value present and confirm the flag is not the last token."],"exampleFix":"// before\nnode scripts/capture.ts --route / --settle-ms\n\n// after\nnode scripts/capture.ts --route / --settle-ms 500","handlingStrategy":"validation","validationCode":"function getValue(flags: string[], name: string): string | undefined {\n  const i = flags.indexOf(name)\n  return i >= 0 ? flags[i + 1] : undefined\n}\nconst settleMs = getValue(argv, '--settle-ms')\nif (!settleMs || !/^\\d+$/.test(settleMs)) {\n  throw new Error('--settle-ms requires a positive integer value')\n}","typeGuard":"function hasFlagValue(flags: string[], name: string): boolean {\n  const i = flags.indexOf(name)\n  return i >= 0 && Boolean(flags[i + 1])\n}","tryCatchPattern":null,"preventionTips":["Always pass a positive integer millisecond value after --settle-ms.","Validate numeric variables before passing them to the script.","Quote the value and ensure the flag is not the last token.","Wrap the invocation in a script that checks all value-bearing flags first."],"tags":["capture-script","cli","validation","arguments"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}