facebook/react · error · Error
393
393
Error message
Cache cannot be refreshed during server rendering.
What it means
In the SSR renderer, useCacheRefresh() returns unsupportedRefresh — a function that always throws (error code 393). Server rendering has no client cache to invalidate, so the refresh capability does not exist during a Fizz render.
Source
Thrown at packages/react-server/src/ReactFizzHooks.js:861
const index = thenableIndexCounter;
thenableIndexCounter += 1;
if (thenableState === null) {
thenableState = createThenableState();
}
return trackUsedThenable(thenableState, thenable, index);
}
export function readPreviousThenableFromState<T>(): T | void {
const index = thenableIndexCounter;
thenableIndexCounter += 1;
if (thenableState === null) {
return undefined;
}
return readPreviousThenable(thenableState, index);
}
function unsupportedRefresh() {
throw new Error('Cache cannot be refreshed during server rendering.');
}
function useCacheRefresh(): <T>(?() => T, ?T) => void {
return unsupportedRefresh;
}
function useMemoCache(size: number): Array<mixed> {
const data = new Array<any>(size);
for (let i = 0; i < size; i++) {
data[i] = REACT_MEMO_CACHE_SENTINEL;
}
return data;
}
function clientHookNotSupported() {
throw new Error(
'Cannot use state or effect Hooks in renderToHTML because ' +
'this component will never be hydrated.',View on GitHub (pinned to eafeac097b)
Solutions
- Trigger cache refreshes only from client-side event handlers or transitions
- Split the refreshing logic into a 'use client' component and keep the server component read-only
- On the server, obtain fresh data per request with fetch()/cache() instead of refreshing
Example fix
// before
function List({items}) {
const refresh = useCacheRefresh();
if (items.stale) refresh(); // called during SSR -> throws
return <ul>...</ul>;
}
// after
// server component stays read-only; refresh lives in a client child
function List({items}) {
return (<ul>...<RefreshButton /></ul>);
}
// RefreshButton.js
// 'use client'
// const refresh = useCacheRefresh();
// <button onClick={() => refresh()}>Refresh</button> Defensive patterns
Strategy: type-guard
Prevention
- Treat the value returned by useCacheRefresh as client-only; never invoke it during render
- Keep refresh handlers in 'use client' files
- For server-side freshness, rely on per-request fetch()/cache() instead of refresh
When it happens
Trigger: Calling the refresh function returned by useCacheRefresh() while server rendering: invoking it during render, from a server-executed callback, or from shared code that runs in the SSR pass.
Common situations: Porting client cache-refresh patterns into components that also render on the server; SSR test suites exercising refresh handlers; React 19 cache() adoption where refresh logic sits next to render code.
Related errors
- Cannot update optimistic state while rendering.
- 384
- react-cache: read and preload may only be called from within
- File/Blob fields are not yet supported in progressive forms.
- Can only set one of `children` or `props.dangerouslySetInner
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/388559521e21d45e.
Report an issue: GitHub.