vercel/turborepo · error · GeneratorError

plop_error_running_generator

plop_error_running_generator

Error message

Failed to run "${qualifiedName(generator)}" generator

What it means

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.

Source

Thrown at packages/turbo-gen/src/utils/plop.ts:394

  const answers = (await gen.runPrompts(bypassArgs)) as Array<unknown>;
  const results = await gen.runActions(
    { ...answers, ...injectTurborepoData({ project, generator: gen }) },
    {
      onComment: (comment: string) => {
        logger.dimmed(comment);
      }
    }
  );

  if (results.failures.length > 0) {
    for (const f of results.failures) {
      if (f instanceof Error) {
        logger.error(`Error - ${f.message}`);
      } else {
        logger.error(`Error - ${f.error}. Unable to ${f.type} to "${f.path}"`);
      }
    }
    throw new GeneratorError(
      `Failed to run "${qualifiedName(generator)}" generator`,
      { type: "plop_error_running_generator" }
    );
  }

  if (results.changes.length > 0) {
    logger.info("Changes made:");
    for (const c of results.changes) {
      if (c.path) {
        logger.item(`${c.path} (${c.type})`);
      }
    }
  }
}

View on GitHub (pinned to f9245100cf)

Solutions

  1. Read each logged failure line; it states the action type, path, and error for the failing step
  2. Fix the templateFile or template referenced by that action and confirm the path is relative to the plopfile
  3. Register every helper and partial your templates use
  4. Delete or move files that block non-forced add actions, or re-run interactively and accept the overwrite

Example fix

// before: template path that does not exist
{ type: "add", path: "src/{{ name }}.ts", templateFile: "turbo/generators/temple.hbs" }
// after: correct path
{ type: "add", path: "src/{{ name }}.ts", templateFile: "turbo/generators/template.hbs" }
Defensive patterns

Strategy: try-catch

Validate before calling

// verify each template referenced by actions exists before running the generator
import fs from "node:fs";
import path from "node:path";

for (const action of actions) {
  if (action.type === "add" && action.templateFile) {
    const t = path.resolve(path.dirname(configPath), action.templateFile);
    if (!fs.existsSync(t)) throw new Error(`Missing template: ${t}`);
  }
}

Try / catch

try {
  await runPlopGenerator(args);
} catch (err) {
  if (err instanceof GeneratorError && err.type === "plop_error_running_generator") {
    // per-action failures were already logged; summarize and exit non-zero
    console.error("Some generator actions failed. Review the logged failures above.");
    process.exitCode = 1;
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vercel/turborepo@f9245100cf (2026-08-17). Data as JSON: /api/errors/8c3c63056dea8d48. Report an issue: GitHub.