{"record":{"id":"c71eeb754894ce78","repo":"gatsbyjs/gatsby","slug":"icon-icon-does-not-exist-as-defined-in-gatsby","errorCode":null,"errorMessage":"icon (${icon}) does not exist as defined in gatsby-config.js. Make sure the file exists relative to the root of the site.","messagePattern":"icon \\((.+?)\\) does not exist as defined in gatsby-config\\.js\\. Make sure the file exists relative to the root of the site\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-plugin-manifest/src/gatsby-node.js","lineNumber":189,"sourceCode":"  // Determine destination path for icons.\n  const paths = {}\n  manifest.icons.forEach(icon => {\n    const iconPath = path.join(`public`, path.dirname(icon.src))\n    if (!paths[iconPath]) {\n      const exists = fs.existsSync(iconPath)\n      // create destination directory if it doesn't exist\n      if (!exists) {\n        fs.mkdirSync(iconPath, { recursive: true })\n      }\n      paths[iconPath] = true\n    }\n  })\n\n  // Only auto-generate icons if a src icon is defined.\n  if (typeof icon !== `undefined`) {\n    // Check if the icon exists\n    if (!doesIconExist(icon)) {\n      throw new Error(\n        `icon (${icon}) does not exist as defined in gatsby-config.js. Make sure the file exists relative to the root of the site.`\n      )\n    }\n\n    const sharp = await getSharpInstance()\n    const sharpIcon = sharp(icon)\n\n    const metadata = await sharpIcon.metadata()\n\n    if (metadata.width !== metadata.height) {\n      reporter.warn(\n        `The icon(${icon}) you provided to 'gatsby-plugin-manifest' is not square.\\n` +\n          `The icons we generate will be square and for the best results we recommend you provide a square icon.\\n`\n      )\n    }\n\n    // add cache busting\n    const cacheMode =","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-plugin-manifest/src/gatsby-node.js#L171-L207","documentation":"Thrown by gatsby-plugin-manifest's onPreInit/build path when an `icon` option is defined but doesIconExist(icon) returns false — the source icon file cannot be read. The plugin needs the source PNG/SVG to generate all derived icon sizes, so it aborts before invoking sharp.","triggerScenarios":"Setting `icon: 'src/images/icon.png'` in gatsby-plugin-manifest options where that file does not exist relative to the site root; typo in the path; icon was deleted after config was written; path is absolute when relative is expected.","commonSituations":"Default config points at src/images/icon.png that the user never added; renamed the icon file; cloned a starter that omitted the image asset; CI checkout missing the asset due to .gitignore or LFS not pulled.","solutions":["Create the icon file at the configured path (PNG recommended, at least 512x512, square).","Correct the `icon` option to match the actual file path relative to the site root.","If you do not want a custom icon, remove the `icon` option to skip auto-generation.","Run `git lfs pull` if the asset is stored in LFS and CI fetches shallow checkouts."],"exampleFix":"// before\n{ resolve: 'gatsby-plugin-manifest', options: { icon: 'src/images/manifest-icon.png' } }\n// after (path matches the existing file)\n{ resolve: 'gatsby-plugin-manifest', options: { icon: 'src/images/icon.png' } }","handlingStrategy":"validation","validationCode":"const fs = require('fs')\nif (options.icon && !fs.existsSync(options.icon)) {\n  console.error(`icon file missing: ${options.icon}`)\n}","typeGuard":"const iconFileExists = (icon?: string): boolean =>\n  !icon || (typeof icon === 'string' && fs.existsSync(icon))","tryCatchPattern":null,"preventionTips":["Create the icon file at the configured path (>=512x512 PNG).","Remove the `icon` option to skip auto-generation.","Run `git lfs pull` when assets are LFS-tracked."],"tags":["gatsby-plugin-manifest","icon","missing-file","config"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}