{"record":{"id":"ef385540697deeea","repo":"shadcn-ui/ui","slug":"the-provided-cwd-must-match-config-resolvedpaths-c","errorCode":null,"errorMessage":"The provided cwd must match config.resolvedPaths.cwd.","messagePattern":"The provided cwd must match config\\.resolvedPaths\\.cwd\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/registry/add.ts","lineNumber":55,"sourceCode":"        ? inputConfig.resolvedPaths.cwd\n        : undefined\n    throw new ConfigParseError(\n      path.resolve(inputCwd ?? configCwd ?? process.cwd()),\n      parsedConfig.error,\n      \"config\"\n    )\n  }\n\n  const configCwd = parsedConfig.success\n    ? parsedConfig.data.resolvedPaths.cwd\n    : undefined\n  const cwd = path.resolve(inputCwd ?? configCwd ?? process.cwd())\n  if (\n    inputCwd !== undefined &&\n    configCwd !== undefined &&\n    cwd !== path.resolve(configCwd)\n  ) {\n    throw new Error(\"The provided cwd must match config.resolvedPaths.cwd.\")\n  }\n\n  const config = configWithDefaults(\n    parsedConfig.success\n      ? parsedConfig.data\n      : {\n          ...inputConfig,\n          resolvedPaths: {\n            ...inputConfig?.resolvedPaths,\n            cwd,\n          },\n        }\n  )\n  const env = await loadEnvFiles(cwd, {\n    processEnv: { ...process.env },\n  })\n\n  return withRegistryContext(","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/registry/add.ts#L37-L73","documentation":"Plain Error thrown by addRegistryItems when both `cwd` (inputCwd) and the config's resolvedPaths.cwd are defined but resolve to different absolute paths. The API treats cwd and config.resolvedPaths.cwd as a single source of truth and refuses ambiguous input rather than guessing which one wins.","triggerScenarios":"Calling addRegistryItems(['x'], { cwd: '/A', config: { resolvedPaths: { cwd: '/B' } } }); passing a cwd that differs in normalization (trailing slash, symlinks) from what the config embeds.","commonSituations":"Programmatic callers computing cwd from process.cwd() while passing a Config resolved earlier from a different directory; symlinked paths where path.resolve does not canonicalize to the same string.","solutions":["Pass only one of `cwd` or a config containing resolvedPaths.cwd — not both with conflicting values.","If you need both, ensure they resolve identically: `path.resolve(cwd) === path.resolve(config.resolvedPaths.cwd)`.","Resolve the Config from the same cwd you pass in, using get-config, before calling addRegistryItems."],"exampleFix":"// before\naddRegistryItems(['button'], {\n  cwd: '/projects/app',\n  config: { resolvedPaths: { cwd: '/projects/other-app' } }\n})\n\n// after — keep them consistent\nconst cwd = '/projects/app'\naddRegistryItems(['button'], {\n  cwd,\n  config: { resolvedPaths: { cwd } }\n})","handlingStrategy":"validation","validationCode":"import path from 'path'\n\nfunction assertCwdConsistent(inputCwd?: string, configCwd?: string) {\n  if (inputCwd !== undefined && configCwd !== undefined &&\n      path.resolve(inputCwd) !== path.resolve(configCwd)) {\n    throw new Error(`cwd (${inputCwd}) must equal config.resolvedPaths.cwd (${configCwd})`)\n  }\n}\n\nassertCwdConsistent(options.cwd, options.config?.resolvedPaths?.cwd)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass only one of `cwd` or a config with resolvedPaths.cwd.","When embedding, resolve Config from the same cwd each call.","Avoid mixing programmatic cwd derivation with pre-resolved Config objects."],"tags":["registry","add","config","validation","path-resolution"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}