{"record":{"id":"43f3e77196f4b5ed","repo":"shadcn-ui/ui","slug":"invalid-config","errorCode":"INVALID_CONFIG","errorMessage":"Invalid provided config configuration in ${cwd}.","messagePattern":"Invalid provided config configuration in (.+?)\\.","errorType":"validation","errorClass":"ConfigParseError","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/registry/add.ts","lineNumber":39,"sourceCode":"    path?: string\n  } = {}\n): Promise<void> {\n  if (items.length === 0) {\n    return\n  }\n\n  const {\n    config: inputConfig,\n    cwd: inputCwd,\n    ...addComponentsOptions\n  } = options\n  const parsedConfig = configSchema.safeParse(inputConfig)\n  if (!parsedConfig.success && inputConfig && \"resolvedPaths\" in inputConfig) {\n    const configCwd =\n      typeof inputConfig.resolvedPaths?.cwd === \"string\"\n        ? 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","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/registry/add.ts#L21-L57","documentation":"ConfigParseError (code INVALID_CONFIG) thrown by addRegistryItems when the passed `config` option fails configSchema validation AND already contains a `resolvedPaths` key. The presence of resolvedPaths signals the caller intended to pass a full project config, so a parse failure is treated as a hard error rather than silently falling back. The message includes the resolved cwd and the Zod error details enumerate every invalid field.","triggerScenarios":"Calling addRegistryItems({ config }) with a hand-built object that includes resolvedPaths but has invalid structure (wrong types, missing required fields, unknown aliases); a programmatically-constructed Config that drifted from the schema after a shadcn upgrade.","commonSituations":"Embedding shadcn as a library and passing a Config literal that does not match the current schema; version skew between the host app's expected Config shape and shadcn's; typos in alias keys.","solutions":["Read the Zod error details in the message — each line shows `<path>: <message>` pinpointing the offending field.","Either omit `resolvedPaths` from the passed config (so shadcn treats it as a partial config and applies defaults), or pass a fully-valid Config.","If embedding, build Config via the same get-config pipeline shadcn uses internally rather than hand-constructing it.","Upgrade the host to match the shadcn version whose schema you target."],"exampleFix":"// before — partial config that declares resolvedPaths but is invalid\naddRegistryItems(['button'], {\n  config: { resolvedPaths: { cwd: '/proj' }, aliases: { ui: 123 } }\n})\n\n// after — either drop resolvedPaths (partial), or pass a valid full config\naddRegistryItems(['button'], {\n  config: { aliases: { ui: '@/components/ui' } }\n})","handlingStrategy":"validation","validationCode":"import { configSchema } from '@/src/schema'\n\nfunction assertConfigOrPartial(input?: Partial<Config>) {\n  if (!input) return\n  const parsed = configSchema.safeParse(input)\n  if (!parsed.success && 'resolvedPaths' in input) {\n    const issues = parsed.error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join('; ')\n    throw new Error(`Invalid config: ${issues}`)\n  }\n}\n\nassertConfigOrPartial(options.config)","typeGuard":"import { configSchema } from '@/src/schema'\n\nfunction isFullValidConfig(c: unknown): c is Config {\n  return configSchema.safeParse(c).success\n}","tryCatchPattern":"import { ConfigParseError } from '@/src/registry/errors'\n\ntry {\n  await addRegistryItems(items, { config })\n} catch (e) {\n  if (e instanceof ConfigParseError) {\n    logger.error(`Config invalid: ${e.message}\\nSuggestion: ${e.suggestion}`)\n    // fall back to omitting resolvedPaths, or re-resolve via get-config\n  } else throw e\n}","preventionTips":["Prefer building Config via get-config rather than literals.","If passing partial config, omit resolvedPaths so shadcn applies defaults.","Pin shadcn version and align Config shape with that version's schema."],"tags":["registry","add","config","validation","schema","zod"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}