{"record":{"id":"0663085385ecc9c8","repo":"gatsbyjs/gatsby","slug":"json-stringify-result","errorCode":null,"errorMessage":"${JSON.stringify(result)}","messagePattern":"\\$\\{JSON\\.stringify\\(result\\)\\}","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deprecated-packages/gatsby-recipes/src/recipe-machine/index.js","lineNumber":114,"sourceCode":"            target: `validateSteps`,\n            actions: assign({\n              recipe: (context, event) => event.data.recipe,\n              stepsAsMdx: (context, event) => event.data.stepsAsMdx,\n              stepsAsJS: (context, event) => event.data.stepsAsJS,\n              exports: (context, event) => event.data.exports,\n            }),\n          },\n        },\n      },\n      validateSteps: {\n        invoke: {\n          id: `validateSteps`,\n          src: async (context, event) => {\n            debug(`validatingSteps`)\n            const result = await validateSteps(context.stepsAsMdx)\n            if (result.length > 0) {\n              debug(`errors found in validation`)\n              throw new Error(JSON.stringify(result))\n            }\n\n            return undefined\n          },\n          onDone: `creatingPlan`,\n          onError: {\n            target: `doneError`,\n            actions: assign({\n              error: (context, event) => JSON.parse(event.data.message),\n            }),\n          },\n        },\n      },\n      creatingPlan: {\n        entry: [`deleteOldPlan`],\n        invoke: {\n          id: `createPlan`,\n          src: (context, event) => async (cb, onReceive) => {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/deprecated-packages/gatsby-recipes/src/recipe-machine/index.js#L96-L132","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the JSON array in the message: each entry describes which step failed and why.","Edit the offending MDX step to match the supported recipe step schema.","Update or downgrade gatsby-recipes to the version the recipe targets."],"exampleFix":"// before — unsupported step in recipe MDX\n<Step type=\"doMagic\" />\n\n// after — supported step\n<Read file=\"./src\" />","handlingStrategy":"try-catch","validationCode":"const result = await validateSteps(stepsAsMdx)\nif (result.length > 0) {\n  // do not throw; surface result[] to the user as a list\n}","typeGuard":"function isValidationErrorArray(v) {\n  return Array.isArray(v) && v.length > 0\n}","tryCatchPattern":"try {\n  await validateSteps(stepsAsMdx)\n} catch (e) {\n  const errors = JSON.parse(e.message) // array of step validation errors\n  errors.forEach(err => console.warn(err))\n}","preventionTips":["Validate recipe MDX steps during authoring, not only at runtime.","Keep recipes aligned with the step schema of the gatsby-recipes version in use.","Surface structured validation errors to the user instead of crashing."],"tags":["recipes","validation","mdx","deprecated"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}