{"record":{"id":"9ee04c5103ee1b7e","repo":"yarnpkg/yarn","slug":"workspaceunknownworkspace","errorCode":null,"errorMessage":"workspaceUnknownWorkspace","messagePattern":"workspaceUnknownWorkspace","errorType":"exception","errorClass":"MessageError","httpStatus":null,"severity":"error","filePath":"src/cli/commands/workspace.js","lineNumber":39,"sourceCode":"    throw new MessageError(reporter.lang('workspaceRootNotFound', config.cwd));\n  }\n\n  if (args.length < 1) {\n    throw new MessageError(reporter.lang('workspaceMissingWorkspace'));\n  }\n\n  if (args.length < 2) {\n    throw new MessageError(reporter.lang('workspaceMissingCommand'));\n  }\n\n  const manifest = await config.findManifest(workspaceRootFolder, false);\n  invariant(manifest && manifest.workspaces, 'We must find a manifest with a \"workspaces\" property');\n\n  const workspaces = await config.resolveWorkspaces(workspaceRootFolder, manifest);\n  const [workspaceName, ...rest] = args || [];\n\n  if (!Object.prototype.hasOwnProperty.call(workspaces, workspaceName)) {\n    throw new MessageError(reporter.lang('workspaceUnknownWorkspace', workspaceName));\n  }\n\n  const workspace = workspaces[workspaceName];\n\n  try {\n    await child.spawn(NODE_BIN_PATH, [YARN_BIN_PATH, ...rest], {\n      stdio: 'inherit',\n      cwd: workspace.loc,\n    });\n  } catch (err) {\n    throw err;\n  }\n}\n","sourceCodeStart":21,"sourceCodeEnd":53,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/cli/commands/workspace.js#L21-L53","documentation":"Thrown by 'yarn workspace' when the supplied workspace name is not a key in the object returned by config.resolveWorkspaces(workspaceRootFolder, manifest). The named workspace is not declared by the root 'workspaces' globs (or has not been installed).","triggerScenarios":"Running 'yarn workspace <unknown> <cmd>' where <unknown> does not match any resolved workspace name (typo, not in 'workspaces' glob, or not yet installed).","commonSituations":"Typo in the workspace name; workspace directory exists but is not covered by the root 'workspaces' glob; 'yarn install' has not been run since adding the workspace; the workspace's own package.json 'name' differs from its folder name (Yarn keys workspaces by package name).","solutions":["List valid workspace names with 'yarn workspaces info' and use the exact key.","Ensure the workspace package is covered by the root 'workspaces' glob and has its own package.json with a 'name'.","Run 'yarn install' so workspaces are resolved into the lockfile."],"exampleFix":"# before\n$ yarn workspace myapp build      # folder is 'app', name is 'my-app'\n# after\n$ yarn workspace my-app build","handlingStrategy":"validation","validationCode":"const manifest = await config.findManifest(workspaceRootFolder, false);\nconst workspaces = await config.resolveWorkspaces(workspaceRootFolder, manifest);\nif (!Object.prototype.hasOwnProperty.call(workspaces, workspaceName)) {\n  throw new Error(`Unknown workspace \"${workspaceName}\". Known: ${Object.keys(workspaces).join(', ')}`);\n}","typeGuard":"function isKnownWorkspace(workspaces: Record<string, unknown>, name: string): boolean {\n  return Object.prototype.hasOwnProperty.call(workspaces, name);\n}","tryCatchPattern":null,"preventionTips":["Key workspaces by package 'name' (not folder); confirm via 'yarn workspaces info'.","Keep the root 'workspaces' glob in sync with the directory layout.","Run 'yarn install' after adding or renaming workspaces."],"tags":["workspaces","manifest","validation"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}