gatsbyjs/gatsby · error

Failed downloading the base64 image for ${url}

Error message

Failed downloading the base64 image for ${url}

What it means

Error "Failed downloading the base64 image for ${url}" thrown in gatsbyjs/gatsby.

Source

Thrown at packages/gatsby-remark-images-contentful/src/utils/index.js:19

const { URL } = require(`url`)
const axios = require(`axios`)

// This should be replaced with the solution for https://github.com/gatsbyjs/gatsby/issues/24220
const getBase64Img = async (url, reporter) => {
  try {
    const response = await axios({
      method: `GET`,
      responseType: `arraybuffer`,
      url: `${url}`,
    })

    const base64Img = `data:${
      response.headers[`content-type`]
    };base64,${new Buffer(response.data).toString(`base64`)}`

    return base64Img
  } catch (err) {
    reporter.panic(`Failed downloading the base64 image for ${url}`, err)
    return undefined
  }
}

const buildResponsiveSizes = async (
  { metadata, imageUrl, options = {} },
  reporter
) => {
  const imageURL = new URL(
    imageUrl.indexOf(`/`) === 0 ? `https:${imageUrl}` : imageUrl
  )

  const { width, height, density } = metadata
  const { maxWidth, sizes } = options
  const aspectRatio = width / height

  const presentationWidth = Math.min(maxWidth, width)
  const presentationHeight = Math.round(presentationWidth * (height / width))

View on GitHub (pinned to 8b06340921)

Solutions

  1. Check the image URL is reachable from the build environment (no firewall or auth blocking the request).
  2. Confirm the remote image still exists and returns a 200 status with an image content type.

When it happens

Trigger: Thrown at packages/gatsby-remark-images-contentful/src/utils/index.js:19 when the library encounters an invalid state.

Common situations: Occurs when downloading a base64-encoded image from a remote URL fails inside gatsby-remark-images-contentful. Typically caused by network errors, expired URLs, or missing authentication. Verify the URL is publicly accessible and retry the build.


AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13). Data as JSON: /api/errors/c8be42e1f56acc86. Report an issue: GitHub.