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
- List actual workspace names (each workspace's package.json "name") and pass the exact string, including scope: --source @acme/utils not utils.
- Re-run without the override to see the interactive list of valid names, then use one of those verbatim.
- If the package was renamed, update the generator invocation in scripts/CI to the new name.
- 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
- Derive generator overrides from package.json names at runtime instead of hardcoding strings.
- Use the same name string everywhere (CI scripts and docs) as in package.json, including @scope/.
- Run once interactively to enumerate valid names, then codify them.
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
- New workspace root detected - unexpected 'workspaces' field
- plop_generator_not_found
- New workspace is missing a package.json file
- New workspace root detected - unexpected pnpm-workspace.yaml
- plop_no_config
AI-assisted analysis of vercel/turborepo@f9245100cf (2026-08-17).
Data as JSON: /api/errors/7d8767caead8c4ea.
Report an issue: GitHub.