{"record":{"id":"7d8767caead8c4ea","repo":"vercel/turborepo","slug":"workspace-override-not-found","errorCode":null,"errorMessage":"Workspace \"${override}\" not found","messagePattern":"Workspace \"(.+?)\" not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/turbo-gen/src/commands/workspace/prompts.ts","lineNumber":163,"sourceCode":"  override,\n  workspaces,\n  workspaceName\n}: {\n  override?: string;\n  workspaces: Array<Workspace | Separator>;\n  workspaceName: string;\n}) {\n  if (override) {\n    const workspaceSource = workspaces.find((workspace) => {\n      if (workspace instanceof Separator) {\n        return false;\n      }\n      return workspace.name === override;\n    }) as Workspace | undefined;\n    if (workspaceSource) {\n      return { answer: workspaceSource };\n    }\n    logger.warn(`Workspace \"${override}\" not found`);\n    logger.log();\n  }\n\n  const answer = await select<Workspace>({\n    message: `Which workspace should \"${workspaceName}\" start from?`,\n    loop: false,\n    pageSize: 25,\n    choices: workspaces.map((choice) => {\n      if (choice instanceof Separator) {\n        return choice;\n      }\n      return {\n        name: `  ${choice.name}`,\n        value: choice\n      };\n    })\n  });\n","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/packages/turbo-gen/src/commands/workspace/prompts.ts#L145-L181","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before: name typo / missing scope\npnpm turbo gen workspace --source acme-utils\n# -> Workspace \"acme-utils\" not found\n\n# after: exact package name from package.json\npnpm turbo gen workspace --source @acme/utils","handlingStrategy":"validation","validationCode":"import { execSync } from \"node:child_process\";\n\nfunction assertWorkspaceExists(name: string, root: string): void {\n  const workspaces: string[] = JSON.parse(\n    execSync(\"pnpm m ls --depth -1 --json\", { cwd: root }).toString()\n  ).flatMap((p: { name: string }) => p.name);\n  if (!workspaces.includes(name)) {\n    throw new Error(\n      `Workspace \"${name}\" not found. Valid: ${workspaces.join(\", \")}`\n    );\n  }\n}","typeGuard":"const isKnownWorkspace = (\n  name: string,\n  known: Set<string>\n): name is (typeof known extends Set<infer T> ? T : never) => known.has(name);\n// usage: if (!isKnownWorkspace(override, names)) -> prompt/abort instead of passing override","tryCatchPattern":null,"preventionTips":["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."],"tags":["turbo-gen","generator","workspace","cli","interactive-prompt"],"backgroundTag":"workspace-not-found","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}