{"record":{"id":"6d5e74f8ff7cb6f7","repo":"moeru-ai/airi","slug":"unsupported-capture-format-requestedformat-e","errorCode":null,"errorMessage":"Unsupported capture format \"${requestedFormat}\". Expected \"png\" or \"avif\".","messagePattern":"Unsupported capture format \"(.+?)\"\\. Expected \"png\" or \"avif\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts","lineNumber":59,"sourceCode":"  }\n\n  const avifBuffer = await transformer.avif({\n    quality: avifQuality,\n    speed: avifSpeed,\n  })\n\n  await writeFile(derivedFilePath, avifBuffer)\n  await rm(artifact.filePath, { force: true })\n\n  return {\n    ...artifact,\n    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","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts#L41-L77","documentation":"Thrown by the capture script's argument validation when the requested screenshot format is neither `png` nor `avif`. The script transcodes PNG captures to AVIF via sharp when `avif` is selected, and only those two formats are wired through the pipeline. The check runs early, before any capture work, to fail fast on invalid CLI input.","triggerScenarios":"Running the capture script with `--format <something>` (or equivalent) where the value is not `png` or `avif` — e.g. `--format jpg`, `--format webp`, or a typo. Also triggered when the format is sourced from a config/env var without validation.","commonSituations":"Contributors passing a familiar image format (jpeg/webp) that the script does not support; CI configs or wrapper scripts that set a format flag incorrectly; typos in the format token.","solutions":["Pass `--format png` (default lossless) or `--format avif` (transcoded, smaller) to the capture script.","If you need another format, capture as PNG and post-process with an image tool outside the script.","Remove any unsupported format value from the wrapper script, CI yaml, or env var feeding the flag.","Re-run with `--help` (or read the script header) to confirm the accepted flag values."],"exampleFix":"// before\nnode scripts/capture.ts --format jpg\n\n// after\nnode scripts/capture.ts --format avif","handlingStrategy":"validation","validationCode":"const SUPPORTED_FORMATS = new Set(['png', 'avif'])\nif (!SUPPORTED_FORMATS.has(requestedFormat)) {\n  throw new Error(`Unsupported capture format. Use one of: ${[...SUPPORTED_FORMATS].join(', ')}`)\n}","typeGuard":"const CAPTURE_FORMATS = ['png', 'avif'] as const\ntype CaptureFormat = (typeof CAPTURE_FORMATS)[number]\n\nfunction isCaptureFormat(value: string): value is CaptureFormat {\n  return (CAPTURE_FORMATS as readonly string[]).includes(value)\n}","tryCatchPattern":null,"preventionTips":["Pass only 'png' or 'avif' to the capture script's --format flag.","Validate the format in wrapper scripts before invoking the capture CLI.","For unsupported formats, capture as PNG and convert with an external image tool.","Keep CI configs and wrapper scripts in sync with the supported flag values."],"tags":["capture-script","cli","validation","image-format"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}