{"record":{"id":"9b4fe0ed3744acd0","repo":"gatsbyjs/gatsby","slug":"you-can-t-use-childimagesharp-together-with-pare","errorCode":null,"errorMessage":"You can't use childImageSharp together with ${parent.name}.${parent.extension} — use publicURL instead. The childImageSharp portion of the query in this file will return null:\\n${context.componentPath}","messagePattern":"You can't use childImageSharp together with (.+?)\\.(.+?) — use publicURL instead\\. The childImageSharp portion of the query in this file will return null:\\\\n(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby-transformer-sharp/src/create-resolvers.js","lineNumber":15,"sourceCode":"const { supportedExtensions } = require(`./supported-extensions`)\n\nmodule.exports = ({ createResolvers, reporter }, pluginOptions = {}) => {\n  const { checkSupportedExtensions = true } = pluginOptions\n\n  const resolvers = {\n    File: {\n      childImageSharp: {\n        resolve: (parent, args, context, info) => {\n          // TODO: In future when components from GraphQL are possible make sure that we can support both supported & unsupported image formats\n          if (\n            !supportedExtensions[parent.extension] &&\n            checkSupportedExtensions\n          ) {\n            reporter.warn(\n              `You can't use childImageSharp together with ${parent.name}.${parent.extension} — use publicURL instead. The childImageSharp portion of the query in this file will return null:\\n${context.componentPath}`\n            )\n          }\n          return info.originalResolver(parent, args, context, info)\n        },\n      },\n    },\n  }\n\n  createResolvers(resolvers)\n}\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-transformer-sharp/src/create-resolvers.js#L1-L27","documentation":"Error \"You can't use childImageSharp together with ${parent.name}.${parent.extension} — use publicURL instead. The childImageSharp portion of the query in this file will return null:\\n${context.componentPath}\" thrown in gatsbyjs/gatsby.","triggerScenarios":"Thrown at packages/gatsby-transformer-sharp/src/create-resolvers.js:15 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Query publicURL instead of childImageSharp for non-image files (PDFs, SVGs, videos, etc.)","Remove the childImageSharp fragment from the query for that file type, or conditionally query it only for supported extensions","If you expect the file to be an image, check its actual extension — it may be misnamed or unsupported by sharp","Set checkSupportedExtensions: false in gatsby-transformer-sharp options only if you accept null results"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}