vercel/swr · error · Error

Fallback data is required when using Suspense in SSR.

Error message

Fallback data is required when using Suspense in SSR.

What it means

Error "Fallback data is required when using Suspense in SSR." thrown in vercel/swr.

Source

Thrown at src/index/use-swr.ts:931

  // Display debug info in React DevTools.
  useDebugValue(returnedData)

  // In Suspense mode, we can't return the empty `data` state.
  // If there is an `error`, the `error` needs to be thrown to the error boundary.
  // If there is no `error`, the `revalidation` promise needs to be thrown to
  // the suspense boundary.
  if (suspense) {
    // SWR should throw when trying to use Suspense on the server with React 18,
    // without providing any fallback data. This causes hydration errors. See:
    // https://github.com/vercel/swr/issues/1832
    if (
      !IS_REACT_LEGACY &&
      IS_SERVER &&
      hasKeyButNoData &&
      isUndefined(preloadedData)
    ) {
      throw new Error('Fallback data is required when using Suspense in SSR.')
    }

    // Always update fetcher and config refs even with the Suspense mode.
    if (hasKeyButNoData) {
      fetcherRef.current = fetcher
      configRef.current = config
      unmountedRef.current = false
    }

    const shouldConsumePreload = !isUndefined(preloadedData) && hasKeyButNoData
    let preloadData = UNDEFINED as Data | undefined

    if (shouldConsumePreload && hasCacheData) {
      preloadData =
        preloadedData && isPromiseLike(preloadedData)
          ? use(preloadedData)
          : preloadedData
      data = preloadData

View on GitHub (pinned to 7173e55b2a)

When it happens

Trigger: Thrown at src/index/use-swr.ts:931 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/swr@7173e55b2a (2026-08-27). Data as JSON: /api/errors/dca4e1e2178aacc0. Report an issue: GitHub.