vercel/turborepo · error · Error

Invalid task name found in turbo.json.

Error message

Invalid task name found in turbo.json.

What it means

The eslint-plugin-turbo calculates task inputs by parsing task names from turbo.json. getTaskAddress splits each task key into an optional workspace name and a script name. It throws this Error when a task name is an empty string, because an empty key cannot address any task.

Solutions

  1. Open turbo.json, find the empty task key, and remove it
  2. If the file is generated, fix the generator so it skips empty task names
  3. Run ESLint again after saving the corrected file

Example fix

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

Strategy: validation

Validate before calling

// scan turbo.json for empty task keys before running eslint-plugin-turbo
import fs from "node:fs";

const config = JSON.parse(fs.readFileSync("turbo.json", "utf8"));
const tasks = config.tasks ?? config.pipeline ?? {};
const emptyKeys = Object.keys(tasks).filter((k) => k.length === 0);
if (emptyKeys.length > 0) {
  throw new Error(`Remove empty task keys from turbo.json: ${emptyKeys}`);
}

Type guard

function isValidTaskName(name: string): boolean {
  return name.length > 0;
}

Prevention

When it happens

Trigger: A turbo.json contains an empty string as a task key, for example "tasks": { "": { ... } }. An empty segment can also appear when a key is produced by string splitting or config merging that yields an empty entry. getTaskAddress receives a zero-length taskName and throws.

Common situations: Hand-editing turbo.json and leaving an empty key. A codemod or script that generates task keys from a list with empty values. YAML to JSON conversion that turns a null key into an empty string.

Related errors


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

Appendix: 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 f9245100cf)