{"record":{"id":"47a7939d55b98a59","repo":"facebook/react","slug":"384","errorCode":"384","errorMessage":"Refreshing the cache is not supported in Server Components.","messagePattern":"Refreshing the cache is not supported in Server Components\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server/src/ReactFlightHooks.js","lineNumber":111,"sourceCode":"  useMemoCache(size: number): Array<any> {\n    const data = new Array<any>(size);\n    for (let i = 0; i < size; i++) {\n      data[i] = REACT_MEMO_CACHE_SENTINEL;\n    }\n    return data;\n  },\n  useCacheRefresh(): <T>(?() => T, ?T) => void {\n    return unsupportedRefresh;\n  },\n  useEffectEvent: unsupportedHook as any,\n};\n\nfunction unsupportedHook(): void {\n  throw new Error('This Hook is not supported in Server Components.');\n}\n\nfunction unsupportedRefresh(): void {\n  throw new Error(\n    'Refreshing the cache is not supported in Server Components.',\n  );\n}\n\nfunction unsupportedContext(): void {\n  throw new Error('Cannot read a Client Context from a Server Component.');\n}\n\nfunction useId(): string {\n  if (currentRequest === null) {\n    throw new Error('useId can only be used while React is rendering');\n  }\n  const id = currentRequest.identifierCount++;\n  // use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client\n  return '_' + currentRequest.identifierPrefix + 'S_' + id.toString(32) + '_';\n}\n\nfunction use<T>(usable: Usable<T>): T {","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactFlightHooks.js#L93-L129","documentation":"In RSC, useCacheRefresh() returns unsupportedRefresh — invoking it throws error code 384. Cache invalidation for Server Components is driven by the framework and request lifecycle, not by render code, so there is no refresh path during server rendering.","triggerScenarios":"Calling the refresh function returned by useCacheRefresh() inside a Server Component render or from any server-executed code path.","commonSituations":"Porting client cache-refresh patterns into server components; sharing refresh helpers between client and server environments; assuming useCacheRefresh is universally available.","solutions":["Move the refresh trigger into a client component's event handler","Use your framework's server-side revalidation strategy for fresh data","Remove the refresh call from the server component and re-request data per render instead"],"exampleFix":"// before (server component)\nexport default function Page({stale}) {\n  const refresh = useCacheRefresh();\n  if (stale) refresh(); // throws in a Server Component\n}\n\n// after\n// Page stays read-only; refresh lives in a client child:\n// 'use client'\n// export function Refresh() {\n//   const refresh = useCacheRefresh();\n//   return <button onClick={() => refresh()}>Refresh</button>;\n// }","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat useCacheRefresh as a client-only capability","Drive server data freshness with per-request fetch or framework revalidation","Keep refresh triggers in 'use client' event handlers"],"tags":["use-cache-refresh","server-components","rsc","cache"],"backgroundTag":"hooks-unsupported-in-server-components","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}