{"record":{"id":"5c1df776d1ded4d0","repo":"withastro/astro","slug":"invalid-quality-for-picture-options-src","errorCode":null,"errorMessage":"Invalid quality for picture \"${options.src}\"","messagePattern":"Invalid quality for picture \"(.+?)\"","errorType":"validation","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/integrations/netlify/src/image-service.ts","lineNumber":67,"sourceCode":"\t\treturn `/.netlify/images?${query}`;\n\t},\n\tgetHTMLAttributes: baseService.getHTMLAttributes,\n\tgetSrcSet: baseService.getSrcSet,\n\tvalidateOptions(options) {\n\t\tverifyOptions(options);\n\n\t\tif (options.format && !SUPPORTED_FORMATS.includes(options.format)) {\n\t\t\tthrow new AstroError(\n\t\t\t\t`Unsupported image format \"${options.format}\"`,\n\t\t\t\t`Use one of ${SUPPORTED_FORMATS.join(', ')} instead.`,\n\t\t\t);\n\t\t}\n\n\t\tif (options.quality) {\n\t\t\toptions.quality =\n\t\t\t\ttypeof options.quality === 'string' ? QUALITY_NAMES[options.quality] : options.quality;\n\t\t\tif (options.quality < 1 || options.quality > 100) {\n\t\t\t\tthrow new AstroError(\n\t\t\t\t\t`Invalid quality for picture \"${options.src}\"`,\n\t\t\t\t\t'Quality needs to be between 1 and 100.',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn options;\n\t},\n};\n\nexport default service;\n","sourceCodeStart":49,"sourceCodeEnd":78,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/integrations/netlify/src/image-service.ts#L49-L78","documentation":"The Netlify image service maps quality presets (low=25, mid=50, high=90, max=100) and then requires the resulting numeric quality to be between 1 and 100. A numeric quality outside that range throws this AstroError from validateOptions. Note the message says picture but it fires for Image/getImage too.","triggerScenarios":"Passing quality: 0, a negative number, a value above 100, or a 0-1 scale float like quality: 0.8 to Image/getImage with the Netlify adapter active.","commonSituations":"Quality values copied from tools that use a 0-1 scale (quality: 0.8) or a 0-100+ scale; passing quality: 0 intending lossless output.","solutions":["Use an integer from 1 to 100, e.g. quality: 80","Use the named presets low, mid, high, or max","Convert 0-1 scale values by multiplying by 100 and rounding"],"exampleFix":"// before\n<Image src={hero} quality={0.8} alt=\"hero\" />\n// after\n<Image src={hero} quality={80} alt=\"hero\" />","handlingStrategy":"validation","validationCode":"const QUALITY_NAMES: Record<string, number> = { low: 25, mid: 50, high: 90, max: 100 };\nfunction normalizeQuality(q: number | string | undefined): number | undefined {\n  const n = typeof q === 'string' ? QUALITY_NAMES[q] : q;\n  return typeof n === 'number' && n >= 1 && n <= 100 ? Math.round(n) : undefined;\n}\nconst quality = normalizeQuality(rawQuality);","typeGuard":"function isValidNetlifyQuality(q: unknown): q is number | 'low' | 'mid' | 'high' | 'max' {\n  if (typeof q === 'string') return q in { low: 1, mid: 1, high: 1, max: 1 };\n  return typeof q === 'number' && q >= 1 && q <= 100;\n}","tryCatchPattern":null,"preventionTips":["Treat quality as 1-100 integers; convert 0-1 scales by multiplying by 100","Prefer the named presets low/mid/high/max for portability across services","Validate shared image option objects in one place before passing to Image/getImage"],"tags":["netlify","image-service","quality","validate-options"],"backgroundTag":"parameter-out-of-range","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}