{"record":{"id":"f7857ef99b32a6cb","repo":"facebook/docusaurus","slug":"error-input-file-is-missing-or-uses-unsupported-i","errorCode":null,"errorMessage":"Error: Input file is missing or uses unsupported image format, lqip v${version}","messagePattern":"Error: Input file is missing or uses unsupported image format, lqip v(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lqip-loader/src/lqip.ts","lineNumber":36,"sourceCode":"  jpeg: 'image/jpeg',\n  jpg: 'image/jpeg',\n  png: 'image/png',\n};\n\n/**\n * It returns a Base64 image string with required formatting to work on the web\n * (<img src=\"..\" /> or in CSS url('..'))\n */\nconst toBase64 = (extMimeType: string, data: Buffer): string =>\n  `data:${extMimeType};base64,${data.toString('base64')}`;\n\nexport async function base64(file: string): Promise<string> {\n  let extension = path.extname(file);\n  extension = extension.split('.').pop()!;\n  const mime = SUPPORTED_MIMES[extension];\n\n  if (!mime) {\n    throw new Error(ERROR_EXT);\n  }\n\n  try {\n    const data = await sharp(file).resize(10).toBuffer();\n    return toBase64(mime, data);\n  } catch (err) {\n    logger.error`Generation of base64 failed for image path=${file}.`;\n    throw err;\n  }\n}\n","sourceCodeStart":18,"sourceCodeEnd":47,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/lqip-loader/src/lqip.ts#L18-L47","documentation":"Thrown by the lqip-loader base64() helper when the image file's extension is not in SUPPORTED_MIMES (only `jpeg`, `jpg`, `png` are supported). The ERROR_EXT constant string is reused from sharp's own error wording and embeds the installed lqip-loader version. Note the throw at line 36 is purely an extension/MIME check; if the extension IS supported but sharp itself fails to decode the file, the catch at line 42 logs and rethrows sharp's error instead.","triggerScenarios":"An MDX/doc page references a `.webp`, `.gif`, `.svg`, `.avif`, or other image whose extension is not in SUPPORTED_MIMES, and lqip-loader tries to generate its low-quality placeholder. Also triggered by an uppercase extension (`.JPG`) since the lookup is case-sensitive (path.extname returns the case as-is).","commonSituations":"Adding modern image formats (webp/avif) to docs while lqip is enabled; macOS/Windows saving files with capitalized extensions; a referenced asset that is actually an SVG masquerading with a raster extension.","solutions":["Convert or replace the image with jpg/png, the only formats lqip-loader currently supports for base64 LQIP.","Rename a case-mismatched extension to lowercase (`.JPG` -> `.jpg`) since SUPPORTED_MIMES keys are lowercase.","Disable LQIP generation for the problematic image or move it out of the lqip-processed asset path.","Extend SUPPORTED_MIMES in a fork only if you also confirm sharp can resize that format to 10px reliably."],"exampleFix":"// before: logo.webp is unsupported\n![logo](./logo.webp)\n// after: convert to png\n![logo](./logo.png)","handlingStrategy":"validation","validationCode":"import path from 'path';\n\nconst SUPPORTED_LQIP_EXT = new Set(['jpg', 'jpeg', 'png']);\n\nfunction isLqipSupportedImage(filePath: string): boolean {\n  const ext = path.extname(filePath).split('.').pop()?.toLowerCase() ?? '';\n  return SUPPORTED_LQIP_EXT.has(ext);\n}\n\n// before referencing an image for lqip:\n// if (!isLqipSupportedImage(assetPath)) convert it to png/jpg first.","typeGuard":"const isLqipSupportedExt = (ext: string): boolean =>\n  ['jpg', 'jpeg', 'png'].includes(ext.toLowerCase());","tryCatchPattern":null,"preventionTips":["Standardize docs images on jpg/png while lqip is enabled.","Lowercase image extensions on commit (git mv Logo.JPG Logo.jpg).","Run a prebuild check that scans referenced assets for unsupported extensions."],"tags":["lqip","image","webpack-loader","sharp"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}