{"record":{"id":"b9425a177cd40e85","repo":"shadcn-ui/ui","slug":"missing-cached-source-for-base-name-file-path","errorCode":null,"errorMessage":"Missing cached source for ${base.name}/${file.path}","messagePattern":"Missing cached source for (.+?)/(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/v4/scripts/build-registry.mts","lineNumber":1099,"sourceCode":"\n      await rimraf(styleOutputDir)\n      await fs.mkdir(styleOutputDir, { recursive: true })\n\n      const styleRegistry = { ...baseRegistry, items: registryItems }\n      const registryTs = `export const registry = ${JSON.stringify(styleRegistry, null, 2)}\\n`\n      await fs.writeFile(path.join(styleOutputDir, \"registry.ts\"), registryTs)\n\n      const filesToBuild = registryItems.flatMap((registryItem) =>\n        normalizeRegistryFiles(registryItem)\n      )\n\n      await runWithConcurrency(\n        filesToBuild,\n        FILE_BUILD_CONCURRENCY,\n        async (file) => {\n          const source = sourceFiles.get(file.path)\n          if (typeof source !== \"string\") {\n            throw new Error(\n              `Missing cached source for ${base.name}/${file.path}`\n            )\n          }\n\n          const fileExtension = path.extname(file.path)\n          const shouldTransform =\n            fileExtension === \".tsx\" || fileExtension === \".ts\"\n\n          const transformedContent = shouldTransform\n            ? await getCachedStyledContent({\n                styleName,\n                baseName: base.name,\n                filePath: file.path,\n                source,\n                styleHash,\n                transformCacheHash,\n                styleMap,\n              })","sourceCodeStart":1081,"sourceCodeEnd":1117,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/apps/v4/scripts/build-registry.mts#L1081-L1117","documentation":"During the per-file styled transform, the build looks up each registry file's original source in an in-memory Map (sourceFiles) keyed by file.path and populated earlier by reading registry/bases/<base>/<path>. If a registry item references a path that is not a key in that map — because the file could not be collected/read or the path differs — source is undefined and the build throws 'Missing cached source for <base>/<path>'.","triggerScenarios":"A registry item lists a file path that does not exist under registry/bases/<base>/; path casing mismatch on a case-sensitive filesystem; a file deleted/renamed between the source-load phase and the transform phase; a registry item pointing at a file in another base.","commonSituations":"Adding a registry item before creating the component file; renaming a .tsx without updating registry.ts; developing on macOS (case-insensitive) then building on Linux CI.","solutions":["Confirm every file.path in the base registry items exists at registry/bases/<base>/<file.path>.","Fix filename casing to match the registry exactly (case-sensitive).","Remove registry items that reference deleted/orphan files."],"exampleFix":"// registry/bases/radix/registry.ts before\n{ name: \"foo\", type: \"registry:ui\", files: [\"ui/foo.tsx\"] } // ui/foo.tsx missing on disk\n\n// after: create the file, or fix the path\n{ name: \"foo\", type: \"registry:ui\", files: [\"ui/button.tsx\"] }","handlingStrategy":"validation","validationCode":"import { promises as fs } from \"fs\"\nimport path from \"path\"\nfor (const item of registryItems) {\n  for (const f of normalizeRegistryFiles(item)) {\n    const abs = path.join(process.cwd(), `registry/bases/${base.name}/${f.path}`)\n    await fs.access(abs) // throws ENOENT if missing — surfaces the bad path early\n  }\n}","typeGuard":"async function fileExists(p: string): Promise<boolean> {\n  try { await fs.access(p); return true } catch { return false }\n}","tryCatchPattern":null,"preventionTips":["Create the component file before adding its registry item.","Keep filename casing identical in registry.ts and on disk (case-sensitive builds).","Add a CI check that every registry file.path resolves under registry/bases/<base>.","When renaming a file, update all registry items referencing it in the same commit."],"tags":["build","registry","filesystem","transform"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}