{"record":{"id":"7f98892e05e7c537","repo":"yarnpkg/yarn","slug":"workspacerootnotfound-7f9889","errorCode":null,"errorMessage":"workspaceRootNotFound","messagePattern":"workspaceRootNotFound","errorType":"exception","errorClass":"MessageError","httpStatus":null,"severity":"error","filePath":"src/cli/commands/workspaces.js","lineNumber":24,"sourceCode":"import buildSubCommands from './_build-sub-commands.js';\nimport {DEPENDENCY_TYPES} from '../../constants.js';\nimport * as child from '../../util/child.js';\nimport {NODE_BIN_PATH, YARN_BIN_PATH} from '../../constants';\n\nconst invariant = require('invariant');\nconst path = require('path');\nconst os = require('os');\nconst semver = require('semver');\n\nexport function hasWrapper(commander: Object, args: Array<string>): boolean {\n  return true;\n}\n\nexport async function info(config: Config, reporter: Reporter, flags: Object, args: Array<string>): Promise<void> {\n  const {workspaceRootFolder} = config;\n\n  if (!workspaceRootFolder) {\n    throw new MessageError(reporter.lang('workspaceRootNotFound', config.cwd));\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\n  const publicData = {};\n\n  for (const workspaceName of Object.keys(workspaces)) {\n    const {loc, manifest} = workspaces[workspaceName];\n\n    const workspaceDependencies = new Set();\n    const mismatchedWorkspaceDependencies = new Set();\n\n    for (const dependencyType of DEPENDENCY_TYPES) {\n      if (dependencyType !== 'peerDependencies') {\n        for (const dependencyName of Object.keys(manifest[dependencyType] || {})) {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/cli/commands/workspaces.js#L6-L42","documentation":"Thrown by 'yarn workspaces info' when config.workspaceRootFolder is falsy. As with error 55, Yarn could not find an ancestor manifest declaring a 'workspaces' field, so there is no workspace tree to report on.","triggerScenarios":"Running 'yarn workspaces info' in a directory whose ancestor chain has no package.json with a 'workspaces' field (or outside any project).","commonSituations":"Single-package project (no workspaces); root manifest missing the 'workspaces' key; wrong cwd.","solutions":["Run from within a workspace project root.","Add a 'workspaces' field to the root package.json and run 'yarn install'.","If you only have one package, 'yarn workspaces info' is not applicable."],"exampleFix":"// before (root package.json)\n{ \"name\": \"root\", \"private\": true }\n// after\n{\n  \"name\": \"root\",\n  \"private\": true,\n  \"workspaces\": [\"packages/*\"]\n}","handlingStrategy":"validation","validationCode":"if (!config.workspaceRootFolder) {\n  throw new Error(`No workspace root found from ${config.cwd}; declare 'workspaces' in the root manifest and run 'yarn install'.`);\n}","typeGuard":"function hasWorkspaceRoot(config: Config): boolean {\n  return typeof config.workspaceRootFolder === 'string' && config.workspaceRootFolder.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Define 'workspaces' in the root manifest before running 'yarn workspaces info'.","Run the command from the workspace root.","Add a CI lint that the root manifest has 'workspaces' for monorepos."],"tags":["workspaces","config","manifest"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}