gatsbyjs/gatsby · error

[gatsby-source-drupal] file returns 404: ${url}

Error message

[gatsby-source-drupal] file returns 404: ${url}

What it means

In getGatsbyImageCdnFields, the plugin requests the remote file to read its image dimensions; when that request 404s, the file is missing on the Drupal server (deleted, renamed, or a stale URL). The plugin warns (max 10 times per build to avoid log flooding) and returns an empty object, so the node gets no Image CDN fields and gatsby-plugin-image data for that file will be absent.

Source

Thrown at packages/gatsby-source-drupal/src/normalize.ts:109

    if (!hasRequiredData(imageSize) || !placeholderUrl) {
      return {}
    }

    const gatsbyImageCdnFields = {
      filename,
      url,
      placeholderUrl,
      width: imageSize.width,
      height: imageSize.height,
      mimeType,
    }

    return gatsbyImageCdnFields
  } catch (e) {
    if (e.message.includes(`404`)) {
      if (four04WarningCount < 10) {
        four04WarningCount++
        reporter.warn(`[gatsby-source-drupal] file returns 404: ${url}`)
      }

      return {}
    }

    if (e.message.includes(`unrecognized file format`)) {
      if (corruptFileWarningCount < 10) {
        corruptFileWarningCount++
        reporter.warn(
          `[gatsby-source-drupal] Encountered corrupt file while requesting image dimensions for ${url}`
        )
      }

      return {}
    }

    reporter.error(e)
    reporter.info(

View on GitHub (pinned to e85d62f177)

Solutions

  1. Fix or remove the content in Drupal that references the missing file so the URL resolves.
  2. Re-save/re-upload the file in Drupal and re-run the build.
  3. Clear Drupal's CDN/reverse-proxy cache if the file exists but the edge still 404s.
  4. If many files 404, audit the Drupal media library for orphaned references.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/gatsby-source-drupal/src/normalize.ts:109 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/2f638ec6e9a126ca. Report an issue: GitHub.