{"record":{"id":"8c3c63056dea8d48","repo":"vercel/turborepo","slug":"plop-error-running-generator-8c3c63","errorCode":"plop_error_running_generator","errorMessage":"Failed to run \"${qualifiedName(generator)}\" generator","messagePattern":"Failed to run \"(.+?)\" generator","errorType":"exception","errorClass":"GeneratorError","httpStatus":null,"severity":"error","filePath":"packages/turbo-gen/src/utils/plop.ts","lineNumber":394,"sourceCode":"  const answers = (await gen.runPrompts(bypassArgs)) as Array<unknown>;\n  const results = await gen.runActions(\n    { ...answers, ...injectTurborepoData({ project, generator: gen }) },\n    {\n      onComment: (comment: string) => {\n        logger.dimmed(comment);\n      }\n    }\n  );\n\n  if (results.failures.length > 0) {\n    for (const f of results.failures) {\n      if (f instanceof Error) {\n        logger.error(`Error - ${f.message}`);\n      } else {\n        logger.error(`Error - ${f.error}. Unable to ${f.type} to \"${f.path}\"`);\n      }\n    }\n    throw new GeneratorError(\n      `Failed to run \"${qualifiedName(generator)}\" generator`,\n      { type: \"plop_error_running_generator\" }\n    );\n  }\n\n  if (results.changes.length > 0) {\n    logger.info(\"Changes made:\");\n    for (const c of results.changes) {\n      if (c.path) {\n        logger.item(`${c.path} (${c.type})`);\n      }\n    }\n  }\n}\n","sourceCodeStart":376,"sourceCodeEnd":409,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/packages/turbo-gen/src/utils/plop.ts#L376-L409","documentation":"When a plop generator runs its actions, node-plop records per-action failures instead of throwing. runPlopGenerator checks results.failures and, when the list is not empty, logs one line per failure and throws this GeneratorError with code plop_error_running_generator. The logs above the error identify the action type, the destination path, and the reason.","triggerScenarios":"An add action references a templateFile that does not exist. A template uses an unregistered helper, so rendering fails. A destination path is outside allowed bounds, or the file exists and the run is not in force mode. Each such action appends to results.failures, which triggers the throw.","commonSituations":"templateFile paths that are relative to the plopfile but written as if relative to cwd. Renaming a partial or helper without updating templates. Non-interactive runs where an add would overwrite existing files. Missing prompt answers used inside paths.","solutions":["Read each logged failure line; it states the action type, path, and error for the failing step","Fix the templateFile or template referenced by that action and confirm the path is relative to the plopfile","Register every helper and partial your templates use","Delete or move files that block non-forced add actions, or re-run interactively and accept the overwrite"],"exampleFix":"// before: template path that does not exist\n{ type: \"add\", path: \"src/{{ name }}.ts\", templateFile: \"turbo/generators/temple.hbs\" }\n// after: correct path\n{ type: \"add\", path: \"src/{{ name }}.ts\", templateFile: \"turbo/generators/template.hbs\" }","handlingStrategy":"try-catch","validationCode":"// verify each template referenced by actions exists before running the generator\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nfor (const action of actions) {\n  if (action.type === \"add\" && action.templateFile) {\n    const t = path.resolve(path.dirname(configPath), action.templateFile);\n    if (!fs.existsSync(t)) throw new Error(`Missing template: ${t}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runPlopGenerator(args);\n} catch (err) {\n  if (err instanceof GeneratorError && err.type === \"plop_error_running_generator\") {\n    // per-action failures were already logged; summarize and exit non-zero\n    console.error(\"Some generator actions failed. Review the logged failures above.\");\n    process.exitCode = 1;\n  } else {\n    throw err;\n  }\n}","preventionTips":["Resolve templateFile paths relative to the plopfile directory deliberately","Dry-run new or changed generators before committing them","Register all helpers and partials, and clean destinations before non-forced adds"],"tags":["turbo-gen","plop","generator","actions","template"],"backgroundTag":"generator-template-error","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}