{"record":{"id":"c91b35d5746cade0","repo":"nexu-io/open-design","slug":"bad-request-c91b35","errorCode":"BAD_REQUEST","errorMessage":"shadcn reference did not resolve to a usable registry item (no name, cssVars, or files)","messagePattern":"shadcn reference did not resolve to a usable registry item \\(no name, cssVars, or files\\)","errorType":"validation","errorClass":"LocalDesignSystemImportError","httpStatus":400,"severity":"error","filePath":"apps/daemon/src/design-systems/shadcn-import.ts","lineNumber":157,"sourceCode":"export async function importShadcnDesignSystemProject(\n  reference: string,\n  tmpRoot: string,\n  userDesignSystemsRoot: string,\n  options: ShadcnDesignSystemImportOptions = {},\n): Promise<LocalDesignSystemImportResult> {\n  // One shared budget across every fetch this import makes (resolution +\n  // include recursion + file fetches): a request count cap and a wall-clock\n  // deadline, layered on top of the per-request timeout.\n  const fetchImpl = withFetchBudget(options.fetchImpl ?? defaultShadcnFetch());\n  const parsed = parseShadcnReference(reference);\n  const importedAt = (options.now ?? new Date()).toISOString();\n  const resolved = await resolveShadcnItem(parsed, fetchImpl);\n  const item = resolved.item;\n\n  const itemName = typeof item.name === 'string' && item.name.trim() ? item.name.trim() : undefined;\n  const hasFiles = Array.isArray(item.files) && item.files.length > 0;\n  if (!itemName && !item.cssVars && !hasFiles) {\n    throw new LocalDesignSystemImportError(\n      'BAD_REQUEST',\n      'shadcn reference did not resolve to a usable registry item (no name, cssVars, or files)',\n    );\n  }\n\n  const materializeRoot = path.join(tmpRoot, 'shadcn-design-system-imports');\n  await mkdir(materializeRoot, { recursive: true });\n  const tempDir = await mkdtemp(path.join(materializeRoot, 'item-'));\n\n  try {\n    await materializeShadcnItem(item, tempDir, resolved, fetchImpl);\n    const fallbackName = cleanShadcnName(item.title ?? itemName ?? 'shadcn design system');\n    return await importLocalDesignSystemProject(tempDir, userDesignSystemsRoot, {\n      now: new Date(importedAt),\n      fallbackName,\n      ...(options.name ? { name: options.name } : {}),\n      ...(options.reservedIds ? { reservedIds: options.reservedIds } : {}),\n      ...(options.importMode ? { importMode: options.importMode } : {}),","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/design-systems/shadcn-import.ts#L139-L175","documentation":"After resolving and fetching a shadcn registry item, the importer checks that the item has at least a name string, a cssVars object, or a non-empty files array (shadcn-import.ts:156). If none are present, the item carries no usable theme or component data and the import is rejected with BAD_REQUEST before any files are written to disk.","triggerScenarios":"Pointing the reference at a registry URL whose resolved item is an empty object {}, or a GitHub shorthand whose registry.json entry for the named item omits name, cssVars, and files.","commonSituations":"The registry item is a placeholder or stub; the URL points to a registry index document that was mistakenly resolved as a single item; the shadcn registry format changed and the fields the importer expects moved or were renamed.","solutions":["Fetch the registry URL manually and confirm the resolved item object has a name, cssVars, or files field","If the URL is a registry index (has items or include arrays), append #<item-name> to select a specific item","Verify the item name in the shorthand matches an entry in registry.json's items array"],"exampleFix":"// before: registry item is empty\n{ \"name\": \"my-theme\" }\n// after: add cssVars or files\n{\n  \"name\": \"my-theme\",\n  \"cssVars\": { \"theme\": { \"primary\": \"#0070f3\" } }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// Type guard for a usable shadcn registry item (if you fetch it yourself)\ninterface ShadcnRegistryItemLike {\n  name?: string;\n  cssVars?: unknown;\n  files?: unknown[];\n}\n\nfunction isUsableRegistryItem(item: unknown): item is ShadcnRegistryItemLike {\n  if (typeof item !== 'object' || item === null) return false;\n  const c = item as ShadcnRegistryItemLike;\n  return (\n    (typeof c.name === 'string' && c.name.trim().length > 0) ||\n    c.cssVars !== undefined ||\n    (Array.isArray(c.files) && c.files.length > 0)\n  );\n}","tryCatchPattern":"import { LocalDesignSystemImportError } from './import.js';\n\ntry {\n  await importShadcnDesignSystem(reference, tmpRoot, dsRoot, options);\n} catch (err) {\n  if (err instanceof LocalDesignSystemImportError && err.code === 'BAD_REQUEST') {\n    // Surface to user: the registry item is empty or malformed.\n    // Suggest verifying the reference URL or item name.\n    return { error: err.message };\n  }\n  throw err;\n}","preventionTips":["Fetch the registry URL manually before importing to confirm the item has name, cssVars, or files","If using a registry index URL, always append #<item-name> to select a specific item","Validate the item name in the shorthand matches an entry in the registry's items array"],"tags":["design-systems","shadcn","validation"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}