{"record":{"id":"746457d6add3a9bf","repo":"shadcn-ui/ui","slug":"fetch-error-746457","errorCode":"FETCH_ERROR","errorMessage":"Failed to read file \"${filePath}\" for registry item \"${itemName}\" (${formatItemSource(source)}). Expected file at ${sourcePath}.","messagePattern":"Failed to read file \"(.+?)\" for registry item \"(.+?)\" \\((.+?)\\)\\. Expected file at (.+?)\\.","errorType":"exception","errorClass":"RegistrySourceFileError","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/registry/source.ts","lineNumber":206,"sourceCode":"    ),\n  }\n}\n\nasync function readRegistryItemFileContent(\n  itemName: string,\n  filePath: string,\n  sourcePath: string,\n  source: RegistryItemSource | undefined,\n  reader: RegistrySourceReader\n) {\n  try {\n    return await reader.readText(sourcePath)\n  } catch (error) {\n    const isGitHubSourceFileError =\n      error instanceof RegistrySourceFileError &&\n      error.context?.reason === \"github-source-file\"\n\n    throw new RegistrySourceFileError(sourcePath, error, {\n      message: `Failed to read file \"${filePath}\" for registry item \"${itemName}\" (${formatItemSource(\n        source\n      )}). Expected file at ${sourcePath}.`,\n      context: {\n        registryFile: source?.registryFile,\n        itemIndex: source?.itemIndex,\n        itemName,\n        itemFilePath: filePath,\n        sourcePath,\n      },\n      suggestion:\n        isGitHubSourceFileError && error.suggestion\n          ? error.suggestion\n          : \"Make sure the file path is relative to the registry.json file that declares the item.\",\n    })\n  }\n}\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/registry/source.ts#L188-L224","documentation":"Thrown by readRegistryItemFileContent when the underlying reader.readText(sourcePath) call for a registry item's declared file fails (file missing, FS permission, or a GitHub source-file error). The original error is wrapped in a RegistrySourceFileError with item name, source file, item index, and a suggestion. If the underlying error was already a GitHub-source-file RegistrySourceFileError, its suggestion is preserved; otherwise the generic 'path relative to registry.json' suggestion is used.","triggerScenarios":"An item in source registry.json declares `files: [{ path: \"./button.tsx\" }]`, but no `button.tsx` exists at that path relative to the declaring registry.json's directory; or the GitHub reader cannot fetch the blob at the resolved ref+path.","commonSituations":"File path typo in the item declaration; file moved/deleted without updating the registry; on GitHub sources, wrong branch/tag/ref or the file lives in a different path; cross-platform path separator mistakes.","solutions":["Confirm the file exists at `<registryDir>/<file.path>` relative to the registry.json that declares the item.","Fix the `path` field in the item's files array to point at the actual file.","For GitHub-backed readers, verify the ref and the blob path are correct (the preserved GitHub suggestion will be more specific)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"async function fileReadable(reader: RegistrySourceReader, sourcePath: string) {\n  try {\n    await reader.readText(sourcePath);\n    return true;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"import { RegistrySourceFileError } from \"@/src/registry/errors\";\n\ntry {\n  await loadRegistryItemFromSource(name, reader, opts);\n} catch (e) {\n  if (e instanceof RegistrySourceFileError) {\n    // e.context.itemFilePath and e.context.sourcePath identify the missing file\n  }\n  throw e;\n}","preventionTips":["Keep every file referenced by an item's `files` array at `<registryDir>/<path>`.","When moving files, update the registry item declarations in the same commit.","For GitHub sources, verify the ref and blob path with a direct API call before publishing."],"tags":["registry","source","files","fetch"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}