facebook/react · error · Error
384
384
Error message
Refreshing the cache is not supported in Server Components.
What it means
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.
Source
Thrown at packages/react-server/src/ReactFlightHooks.js:111
useMemoCache(size: number): Array<any> {
const data = new Array<any>(size);
for (let i = 0; i < size; i++) {
data[i] = REACT_MEMO_CACHE_SENTINEL;
}
return data;
},
useCacheRefresh(): <T>(?() => T, ?T) => void {
return unsupportedRefresh;
},
useEffectEvent: unsupportedHook as any,
};
function unsupportedHook(): void {
throw new Error('This Hook is not supported in Server Components.');
}
function unsupportedRefresh(): void {
throw new Error(
'Refreshing the cache is not supported in Server Components.',
);
}
function unsupportedContext(): void {
throw new Error('Cannot read a Client Context from a Server Component.');
}
function useId(): string {
if (currentRequest === null) {
throw new Error('useId can only be used while React is rendering');
}
const id = currentRequest.identifierCount++;
// use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client
return '_' + currentRequest.identifierPrefix + 'S_' + id.toString(32) + '_';
}
function use<T>(usable: Usable<T>): T {View on GitHub (pinned to eafeac097b)
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
Example fix
// before (server component)
export default function Page({stale}) {
const refresh = useCacheRefresh();
if (stale) refresh(); // throws in a Server Component
}
// after
// Page stays read-only; refresh lives in a client child:
// 'use client'
// export function Refresh() {
// const refresh = useCacheRefresh();
// return <button onClick={() => refresh()}>Refresh</button>;
// } Defensive patterns
Strategy: fallback
Prevention
- 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
When it happens
Trigger: Calling the refresh function returned by useCacheRefresh() inside a Server Component render or from any server-executed code path.
Common situations: Porting client cache-refresh patterns into server components; sharing refresh helpers between client and server environments; assuming useCacheRefresh is universally available.
Related errors
- An unknown Component is an async Client Component. Only Serv
- Attempted to call the default export of ${url} from the serv
- Attempted to call ${name}() from the server but ${name} is o
- Attempted to call ${String(name)}() from the server but ${St
- 393
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/47a7939d55b98a59.
Report an issue: GitHub.