vercel/turborepo · warning

Workspace "${override}" not found

Error message

Workspace "${override}" not found

What it means

In `turbo gen workspace`, the source-workspace prompt accepts an override (typically a non-interactive flag) and looks it up by exact name in the list of detected workspaces (packages/turbo-gen/src/commands/workspace/prompts.ts:154-163). If no workspace matches the string, turbo logs this warning and falls back to the interactive select prompt.

Source

Thrown at packages/turbo-gen/src/commands/workspace/prompts.ts:163

  override,
  workspaces,
  workspaceName
}: {
  override?: string;
  workspaces: Array<Workspace | Separator>;
  workspaceName: string;
}) {
  if (override) {
    const workspaceSource = workspaces.find((workspace) => {
      if (workspace instanceof Separator) {
        return false;
      }
      return workspace.name === override;
    }) as Workspace | undefined;
    if (workspaceSource) {
      return { answer: workspaceSource };
    }
    logger.warn(`Workspace "${override}" not found`);
    logger.log();
  }

  const answer = await select<Workspace>({
    message: `Which workspace should "${workspaceName}" start from?`,
    loop: false,
    pageSize: 25,
    choices: workspaces.map((choice) => {
      if (choice instanceof Separator) {
        return choice;
      }
      return {
        name: `  ${choice.name}`,
        value: choice
      };
    })
  });

View on GitHub (pinned to f9245100cf)

Solutions

  1. List actual workspace names (each workspace's package.json "name") and pass the exact string, including scope: --source @acme/utils not utils.
  2. Re-run without the override to see the interactive list of valid names, then use one of those verbatim.
  3. If the package was renamed, update the generator invocation in scripts/CI to the new name.
  4. In non-interactive environments, validate the name against the workspace list before invoking the generator.

Example fix

# before: name typo / missing scope
pnpm turbo gen workspace --source acme-utils
# -> Workspace "acme-utils" not found

# after: exact package name from package.json
pnpm turbo gen workspace --source @acme/utils
Defensive patterns

Strategy: validation

Validate before calling

import { execSync } from "node:child_process";

function assertWorkspaceExists(name: string, root: string): void {
  const workspaces: string[] = JSON.parse(
    execSync("pnpm m ls --depth -1 --json", { cwd: root }).toString()
  ).flatMap((p: { name: string }) => p.name);
  if (!workspaces.includes(name)) {
    throw new Error(
      `Workspace "${name}" not found. Valid: ${workspaces.join(", ")}`
    );
  }
}

Type guard

const isKnownWorkspace = (
  name: string,
  known: Set<string>
): name is (typeof known extends Set<infer T> ? T : never) => known.has(name);
// usage: if (!isKnownWorkspace(override, names)) -> prompt/abort instead of passing override

Prevention

When it happens

Trigger: Calling the workspace generator with a --source/--workspace override whose value does not equal any workspace package name (names come from each package's package.json "name", plus workspace globs). Case differences, scoped-name typos, or paths instead of names fail the exact `workspace.name === override` comparison.

Common situations: CI or scripted invocations passing a guessed workspace name, refactors that renamed a package without updating the generator command, passing a directory path instead of the package name, or scoped packages where the @scope/ prefix was omitted.

Related errors


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