gatsbyjs/gatsby · error

${chalk.bold(loading)} is an invalid value for the ${chalk.b

Error message

${chalk.bold(loading)} is an invalid value for the ${chalk.bold(`loading`)} option. Please pass one of "lazy", "eager" or "auto".

What it means

Option-validation warning while generating markup for a Contentful image node: the `loading` option value is not one of 'lazy', 'eager' or 'auto'. The generated <img> still uses the invalid value (browsers default to 'auto'-like behavior), but the warning tells you to correct the gatsby-remark-images-contentful plugin option.

Source

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

      },
      reporter
    )

    // Calculate the paddingBottom %
    const ratio = `${(1 / responsiveSizesResult.aspectRatio) * 100}%`

    const fallbackSrc = originalImg
    const srcSet = responsiveSizesResult.srcSet
    const presentationWidth = responsiveSizesResult.presentationWidth

    // Generate default alt tag
    const fileNameNoExt = fileName.replace(/\.[^/.]+$/, ``)
    const defaultAlt = fileNameNoExt.replace(/[^A-Z0-9]/gi, ` `)

    const loading = options.loading

    if (![`lazy`, `eager`, `auto`].includes(loading)) {
      reporter.warn(
        reporter.stripIndent(`
        ${chalk.bold(loading)} is an invalid value for the ${chalk.bold(
          `loading`
        )} option. Please pass one of "lazy", "eager" or "auto".
      `)
      )
    }

    // Create our base image tag
    let imageTag = `
      <img
        class="gatsby-resp-image-image"
        style="width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px ${
          options.backgroundColor
        };"
        alt="${node.alt ? node.alt : defaultAlt}"
        title="${node.title ? node.title : ``}"
        src="${fallbackSrc}"

View on GitHub (pinned to e85d62f177)

Solutions

  1. Set loading to "lazy", "eager" or "auto" in plugin options
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby-remark-images-contentful/src/index.js:123 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/4a0b148bade287a2. Report an issue: GitHub.