{"record":{"id":"694910b4acbb01f1","repo":"gatsbyjs/gatsby","slug":"gatsby-transformer-sharp-20001","errorCode":"gatsby-transformer-sharp_20001","errorMessage":"error copying file from ${details.absolutePath} to ${publicPath}","messagePattern":"error copying file from (.+?) to (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-transformer-sharp/src/customize-schema.js","lineNumber":619,"sourceCode":"          process.cwd(),\n          `public`,\n          `static`,\n          imageName\n        )\n\n        if (!fs.existsSync(publicPath) && !inProgressCopy.has(publicPath)) {\n          // keep track of in progress copy, we should rely on `existsSync` but\n          // a race condition exists between the exists check and the copy\n          inProgressCopy.add(publicPath)\n          fs.copy(\n            details.absolutePath,\n            publicPath,\n            { dereference: true },\n            err => {\n              // this is no longer in progress\n              inProgressCopy.delete(publicPath)\n              if (err) {\n                reporter.panic(\n                  {\n                    id: prefixId(CODES.MissingResource),\n                    context: {\n                      sourceMessage: `error copying file from ${details.absolutePath} to ${publicPath}`,\n                    },\n                  },\n                  err\n                )\n              }\n            }\n          )\n        }\n\n        return {\n          width: dimensions.width,\n          height: dimensions.height,\n          src: `${pathPrefix}/static/${imageName}`,\n        }","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby-transformer-sharp/src/customize-schema.js#L601-L637","documentation":"Thrown by gatsby-transformer-sharp during customize-schema when fs.copy (fs-extra) fails to copy a source image file to the public output directory. The error uses the MissingResource code (20001) and reports both the absolute source path and the public destination. It runs inside the copy callback, after an existsSync race-guard, so a genuine I/O or permission failure is the cause.","triggerScenarios":"fs.copy invokes its callback with a non-null err: source file was deleted between discovery and copy, permission denied reading the source or writing publicPath, disk full, path-too-long on Windows, or a cross-device move that copy cannot resolve.","commonSituations":"A source image referenced in a node was removed from disk between sourcing and image processing; read-only mounts in CI/Docker; .cache/public on a volume that is out of space; symlink loops with dereference:true; Windows path length limits.","solutions":["Confirm the source file at details.absolutePath still exists and is readable by the build process.","Check write permissions and free space on the volume holding publicPath.","Delete .cache and public, then rebuild to regenerate stale references.","If using Docker/CI, ensure the workspace is bind-mounted read-write and not truncated by image size limits."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before triggering sharp processing, ensure source files exist:\nconst fs = require('fs')\nfor (const node of nodes) {\n  if (node.absolutePath && !fs.existsSync(node.absolutePath)) {\n    reporter.warn(`Skipping image; missing on disk: ${node.absolutePath}`)\n    continue\n  }\n  // ...createFile / sharp call\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit or upload all referenced source images before building.","Run builds on read-write volumes with adequate free space.","Clean .cache and public between major content changes.","Avoid symlink loops under dereference:true copies."],"tags":["filesystem","transformer-sharp","image","io"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}