vercel/turborepo · error · Error

Invalid task name found in turbo.json.

Error message

Invalid task name found in turbo.json.

What it means

eslint-plugin-turbo computes task inputs (for rules like no-undeclared-env-vars) by parsing every task key in turbo.json. getTaskAddress splits each key into workspace/script parts; a task key that is the empty string has no script name, so the plugin throws this Error while the ESLint rule builds its input map.

Source

Thrown at packages/eslint-plugin-turbo/lib/utils/calculate-inputs.ts:232

function environmentTestArray(envContext: EnvironmentTest) {
  return [
    envContext.legacyConfig,
    envContext.env,
    envContext.passThroughEnv,
    envContext.dotEnv
  ];
}

// Identify where to store `EnvironmentConfig`s

function getTaskAddress(taskName: string): {
  workspaceName: string | null;
  scriptName: string;
} {
  // Somehow empty. Error.
  if (taskName.length === 0) {
    throw new Error("Invalid task name found in turbo.json.");
  }

  const firstIndexOf = taskName.indexOf("#");

  // Something like "build"
  if (firstIndexOf === -1) {
    return {
      workspaceName: null,
      scriptName: taskName
    };
  }

  // Something like "what#are#you#doing"
  if (firstIndexOf !== taskName.lastIndexOf("#")) {
    throw new Error("Invalid task name found in turbo.json.");
  }

  const [workspaceName, scriptName] = taskName.split("#");

View on GitHub (pinned to 9f94a7d215)

Solutions

  1. Open turbo.json and delete the empty `""` key under tasks/pipeline
  2. Validate the config with `npx turbo run build --dry=json` — the turbo CLI will reject the same invalid shape
  3. Point your editor at the turbo.json JSON schema (https://turborepo.com/schema.json) to catch invalid keys as you type

Example fix

// turbo.json (before)
"tasks": { "": { "outputs": ["dist"] }, "build": { } }
// after
"tasks": { "build": { "outputs": ["dist"] } }
Defensive patterns

Strategy: validation

Validate before calling

function hasEmptyTaskKey(turboJson: { tasks?: Record<string, unknown>; pipeline?: Record<string, unknown> }): boolean {
  const tasks = turboJson.tasks ?? turboJson.pipeline ?? {};
  return Object.keys(tasks).some((k) => k.length === 0);
}
// gate CI: if (hasEmptyTaskKey(turboJson)) fail fast with a clear message

Type guard

function isValidTaskKey(key: string): boolean {
  return key.length > 0 && key.indexOf('#') === key.lastIndexOf('#');
}

Prevention

When it happens

Trigger: A turbo.json whose `tasks` (or legacy `pipeline`) object contains an empty-string key, e.g. `"tasks": { "": { "outputs": ["dist"] } }`. Typically produced by templating bugs, JSON generation/merging, or hand edits.

Common situations: Generated turbo.json from scripts that map over an empty/blank task list; config merge artifacts; YAML-to-JSON conversions emitting an empty key; the error surfaces as an ESLint crash when the plugin rule runs.

Related errors


AI-assisted analysis of vercel/turborepo@9f94a7d215 (2026-08-16). Data as JSON: /api/errors/243cbd9513bc5b78. Report an issue: GitHub.