{"record":{"id":"140e55fb2611e531","repo":"facebook/react","slug":"starttransition-cannot-be-called-during-server-ren","errorCode":null,"errorMessage":"startTransition cannot be called during server rendering.","messagePattern":"startTransition cannot be called during server rendering\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server/src/ReactFizzHooks.js","lineNumber":642,"sourceCode":"  getSnapshot: () => T,\n  getServerSnapshot?: () => T,\n): T {\n  if (getServerSnapshot === undefined) {\n    throw new Error(\n      'Missing getServerSnapshot, which is required for ' +\n        'server-rendered content. Will revert to client rendering.',\n    );\n  }\n  return getServerSnapshot();\n}\n\nfunction useDeferredValue<T>(value: T, initialValue?: T): T {\n  resolveCurrentlyRenderingComponent();\n  return initialValue !== undefined ? initialValue : value;\n}\n\nfunction unsupportedStartTransition() {\n  throw new Error('startTransition cannot be called during server rendering.');\n}\n\nfunction useTransition(): [\n  boolean,\n  (callback: () => void, options?: StartTransitionOptions) => void,\n] {\n  resolveCurrentlyRenderingComponent();\n  return [false, unsupportedStartTransition];\n}\n\nfunction useHostTransitionStatus(): TransitionStatus {\n  resolveCurrentlyRenderingComponent();\n  return NotPendingTransition;\n}\n\nfunction unsupportedSetOptimisticState() {\n  throw new Error('Cannot update optimistic state while rendering.');\n}","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactFizzHooks.js#L624-L660","documentation":"In Fizz, useTransition returns [false, unsupportedStartTransition]: transitions schedule updates, which is meaningless during the single pass of server rendering. Calling the returned startTransition function — or any code path that invokes it during SSR — throws immediately.","triggerScenarios":"const [isPending, start] = useTransition(); start(() => select(item)) executed in a server-rendered component's body or a render helper; calling React.startTransition in code that runs during SSR; shared logic that kicks off transitions at render time.","commonSituations":"Components that start transitions during render instead of in handlers; React 18 to 19 upgrades where transition code newly runs during SSR; libraries invoking startTransition in initialization code that the server graph imports.","solutions":["Move the startTransition call into an event handler (onClick, onSubmit) or effect so it runs only after hydration","Render the initial state directly on the server — transitions are a client-side interaction concern","Guard shared code so the transition path executes only inside browser event handlers"],"exampleFix":"// before\nfunction Row({item, select}) {\n  const [, start] = useTransition();\n  start(() => select(item)); // called during render/SSR -> throws\n}\n\n// after\nfunction Row({item, select}) {\n  const [, start] = useTransition();\n  return <li onClick={() => start(() => select(item))}>{item.name}</li>;\n}","handlingStrategy":"validation","validationCode":"// Guard shared code so transitions never run on the server.\nconst [, start] = useTransition();\nconst safeStart = callback => {\n  if (typeof window === 'undefined') return; // SSR: skip\n  start(callback);\n};","typeGuard":null,"tryCatchPattern":"try {\n  start(() => select(item));\n} catch (e) {\n  if (String(e.message).includes('startTransition cannot be called during server rendering')) {\n    // Move the call into an event handler; SSR renders initial state only.\n  } else {\n    throw e;\n  }\n}","preventionTips":["Call startTransition only inside event handlers and effects, never during render","Design server rendering as a pure single pass — render initial state directly","When sharing logic between client and server, gate transition code to browser-only paths"],"tags":["hooks","usetransition","starttransition","ssr","fizz"],"backgroundTag":"start-transition-during-ssr","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}