gatsbyjs/gatsby · error

${JSON.stringify(result)}

Error message

${JSON.stringify(result)}

What it means

Thrown by the `validateSteps` state of the recipe machine (recipe-machine/index.js:114). `validateSteps(context.stepsAsMdx)` returns an array of validation errors; if the array is non-empty the machine throws `JSON.stringify(result)` so the downstream `onError` handler can `JSON.parse(event.data.message)` and surface the structured list. The visible message is the raw JSON of the validation errors.

Source

Thrown at deprecated-packages/gatsby-recipes/src/recipe-machine/index.js:114

            target: `validateSteps`,
            actions: assign({
              recipe: (context, event) => event.data.recipe,
              stepsAsMdx: (context, event) => event.data.stepsAsMdx,
              stepsAsJS: (context, event) => event.data.stepsAsJS,
              exports: (context, event) => event.data.exports,
            }),
          },
        },
      },
      validateSteps: {
        invoke: {
          id: `validateSteps`,
          src: async (context, event) => {
            debug(`validatingSteps`)
            const result = await validateSteps(context.stepsAsMdx)
            if (result.length > 0) {
              debug(`errors found in validation`)
              throw new Error(JSON.stringify(result))
            }

            return undefined
          },
          onDone: `creatingPlan`,
          onError: {
            target: `doneError`,
            actions: assign({
              error: (context, event) => JSON.parse(event.data.message),
            }),
          },
        },
      },
      creatingPlan: {
        entry: [`deleteOldPlan`],
        invoke: {
          id: `createPlan`,
          src: (context, event) => async (cb, onReceive) => {

View on GitHub (pinned to 8b06340921)

Solutions

  1. Read the JSON array in the message: each entry describes which step failed and why.
  2. Edit the offending MDX step to match the supported recipe step schema.
  3. Update or downgrade gatsby-recipes to the version the recipe targets.

Example fix

// before — unsupported step in recipe MDX
<Step type="doMagic" />

// after — supported step
<Read file="./src" />
Defensive patterns

Strategy: try-catch

Validate before calling

const result = await validateSteps(stepsAsMdx)
if (result.length > 0) {
  // do not throw; surface result[] to the user as a list
}

Type guard

function isValidationErrorArray(v) {
  return Array.isArray(v) && v.length > 0
}

Try / catch

try {
  await validateSteps(stepsAsMdx)
} catch (e) {
  const errors = JSON.parse(e.message) // array of step validation errors
  errors.forEach(err => console.warn(err))
}

Prevention

When it happens

Trigger: Authoring an MDX recipe whose steps use unsupported directives, unknown components, malformed frontmatter, or step shapes the validator rejects; the parsed recipe steps fail schema validation.

Common situations: Writing a custom recipe with a typo'd step type; using a recipe written for a newer/older gatsby-recipes version with incompatible step schemas; mixing markdown-only syntax where structured steps are required.

Related errors


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