{"record":{"id":"05c8615ecbf5e4ac","repo":"shadcn-ui/ui","slug":"invalid-configuration-found-in-highlighter-info","errorCode":null,"errorMessage":"Invalid configuration found in ${highlighter.info(componentPath)}.","messagePattern":"Invalid configuration found in (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/utils/get-config.ts","lineNumber":223,"sourceCode":"\n    // Check if user is trying to override built-in registries\n    if (config.registries) {\n      for (const registryName of Object.keys(config.registries)) {\n        if (registryName in BUILTIN_REGISTRIES) {\n          throw new Error(\n            `\"${registryName}\" is a built-in registry and cannot be overridden.`\n          )\n        }\n      }\n    }\n\n    return config\n  } catch (error) {\n    const componentPath = `${cwd}/components.json`\n    if (error instanceof Error && error.message.includes(\"reserved registry\")) {\n      throw error\n    }\n    throw new Error(\n      `Invalid configuration found in ${highlighter.info(componentPath)}.`\n    )\n  }\n}\n\n// Note: we can check for -workspace.yaml or \"workspace\" in package.json.\n// Since cwd is not necessarily the root of the project.\n// We'll instead check if ui aliases resolve to a different root.\nexport async function getWorkspaceConfig(config: Config) {\n  let resolvedAliases: any = {}\n\n  for (const key of Object.keys(config.aliases)) {\n    if (!isAliasKey(key, config)) {\n      continue\n    }\n\n    const resolvedPath = config.resolvedPaths[key]\n    const packageRoot = await findPackageRoot(","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/utils/get-config.ts#L205-L241","documentation":"Thrown by the catch block of getRawConfig when parsing components.json fails for any reason other than the reserved-registry case. rawConfigSchema.parse runs a zod schema over the file contents; on failure (or any other thrown error whose message does not include \"reserved registry\"), the error is rethrown as a generic invalid-configuration message pointing at the components.json path.","triggerScenarios":"cosmiconf explorer.search(cwd) finds components.json, but rawConfigSchema.parse throws a ZodError (missing required fields, wrong types, unknown style, etc.), or another error occurs. The catch swallows the detail and throws this generic message.","commonSituations":"components.json missing required fields (style, tailwind, aliases); typo in a field name; wrong TypeScript style value; leftover field from an old shadcn version; JSON syntax error that cosmiconf still parsed loosely.","solutions":["Open components.json and check required fields: \"$schema\", \"style\", \"rsc\", \"tsx\", \"tailwind\" (config + css), \"aliases\" (components, utils, ui, lib, hooks), \"iconLibrary\".","Compare against a known-good config from `npx shadcn@latest init` in a fresh project.","Run `npx shadcn@latest init` to regenerate a valid components.json.","If you need the underlying zod error detail, temporarily call rawConfigSchema.parse on the parsed JSON to see field-level issues."],"exampleFix":"// components.json (before) — missing style + aliases\n{ \"$schema\": \"...\", \"rsc\": true }\n// after\n{\n  \"$schema\": \"https://ui.shadcn.com/schema.json\",\n  \"style\": \"new-york\",\n  \"rsc\": true,\n  \"tsx\": true,\n  \"tailwind\": { \"config\": \"tailwind.config.ts\", \"css\": \"app/globals.css\", \"baseColor\": \"neutral\" },\n  \"aliases\": { \"components\": \"@/components\", \"utils\": \"@/lib/utils\", \"ui\": \"@/components/ui\", \"lib\": \"@/lib\", \"hooks\": \"@/hooks\" },\n  \"iconLibrary\": \"lucide\"\n}","handlingStrategy":"try-catch","validationCode":"import { rawConfigSchema } from \"@shadcn/schema\"\nconst parsed = rawConfigSchema.safeParse(configJson)\nif (!parsed.success) {\n  throw new Error(`invalid components.json: ${parsed.error.message}`)\n}","typeGuard":"const isRawConfig = (v: unknown): v is RawConfig =>\n  rawConfigSchema.safeParse(v).success","tryCatchPattern":"try {\n  await getRawConfig(cwd)\n} catch (e) {\n  if (e instanceof Error && /Invalid configuration found/.test(e.message)) {\n    // call rawConfigSchema.parse directly to surface zod details\n  }\n  throw e\n}","preventionTips":["Generate components.json via `npx shadcn@latest init`.","Keep the $schema field pointing at the current schema URL for editor validation.","Validate components.json against rawConfigSchema in CI.","Avoid hand-editing required fields without consulting the schema."],"tags":["config","init","validation","schema"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}