{"record":{"id":"f23dd13034ff8a7b","repo":"shadcn-ui/ui","slug":"forbidden","errorCode":"FORBIDDEN","errorMessage":"You are not authorized to access the item at ${url}. If this is a remote registry, you may need to authenticate.","messagePattern":"You are not authorized to access the item at (.+?)\\. If this is a remote registry, you may need to authenticate\\.","errorType":"http","errorClass":"RegistryForbiddenError","httpStatus":403,"severity":"error","filePath":"packages/shadcn/src/registry/fetcher.ts","lineNumber":103,"sourceCode":"                  messageFromServer = `[${parsed.data.error}] ${messageFromServer}`\n                }\n              }\n            }\n\n            if (response.status === 401) {\n              throw new RegistryUnauthorizedError(url, messageFromServer)\n            }\n\n            if (response.status === 404) {\n              throw new RegistryNotFoundError(url, messageFromServer)\n            }\n\n            if (response.status === 410) {\n              throw new RegistryGoneError(url, messageFromServer)\n            }\n\n            if (response.status === 403) {\n              throw new RegistryForbiddenError(url, messageFromServer)\n            }\n\n            throw new RegistryFetchError(\n              url,\n              response.status,\n              messageFromServer\n            )\n          }\n\n          return response.json()\n        })()\n\n        if (options.useCache) {\n          registryCache.set(cacheKey, fetchPromise)\n        }\n        return fetchPromise\n      })\n    )","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/registry/fetcher.ts#L85-L121","documentation":"Thrown by fetchRegistry when the registry endpoint responds with HTTP 403. RegistryForbiddenError means the request was authenticated (or auth was not required) but the principal is not permitted to access this specific resource. Distinct from 401 (no/invalid auth).","triggerScenarios":"A valid token that lacks scope for the requested item, an IP/origin restriction on the registry, or a registry that allows listing but restricts certain items to paid/entitled users.","commonSituations":"Team-tier item on a paid registry accessed with a free-tier token, geo/IP blocking by a corporate registry, or a registry that requires an additional entitlement header.","solutions":["Confirm the token has the required scope/entitlement for the item.","Check whether the registry enforces IP/origin allow-lists and request access.","Add any required custom headers (e.g. entitlement, plan) in components.json headers.","Contact the registry operator to grant access if the token should work."],"exampleFix":"// before: token lacks scope\n{ \"headers\": { \"Authorization\": \"Bearer ${REGISTRY_TOKEN}\" } }\n\n// after: use a token with the required scope / add entitlement header\n{ \"headers\": {\n    \"Authorization\": \"Bearer ${REGISTRY_TOKEN}\",\n    \"X-Plan\": \"${REGISTRY_PLAN}\"\n} }","handlingStrategy":"validation","validationCode":"function ensureEntitlementHeaders(config: { headers?: Record<string,string> }, required: string[]) {\n  const present = new Set(Object.keys(config.headers ?? {}).map(k => k.toLowerCase()));\n  const missing = required.filter(h => !present.has(h.toLowerCase()));\n  if (missing.length) throw new Error(`Missing headers: ${missing.join(\", \")}`);\n}","typeGuard":"function isForbiddenError(err: unknown): boolean {\n  return err instanceof RegistryForbiddenError;\n}","tryCatchPattern":"try {\n  await fetchRegistry([url]);\n} catch (err) {\n  if (err instanceof RegistryForbiddenError) {\n    // prompt for an upgraded token / entitlement, then retry once\n  }\n  throw err;\n}","preventionTips":["Confirm the auth token's scopes include the target item before running.","Document which items require elevated entitlements.","Distinguish 403 (forbidden) from 401 (unauthenticated) in user-facing messages."],"tags":["network","forbidden","auth","registry","typescript"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}