{"record":{"id":"9f2abc1dbd0c8329","repo":"facebook/react","slug":"a-timeline-is-required-as-the-first-argument-to-st","errorCode":null,"errorMessage":"A Timeline is required as the first argument to startGestureTransition.","messagePattern":"A Timeline is required as the first argument to startGestureTransition\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react/src/ReactStartTransition.js","lineNumber":135,"sourceCode":"  }\n}\n\nexport function startGestureTransition(\n  provider: GestureProvider,\n  scope: () => void,\n  options?: GestureOptions & StartTransitionOptions,\n): () => void {\n  if (!enableGestureTransition) {\n    // eslint-disable-next-line react-internal/prod-error-codes\n    throw new Error(\n      'startGestureTransition should not be exported when the enableGestureTransition flag is off.',\n    );\n  }\n  if (provider == null) {\n    // We enforce this at runtime even though the type also enforces it since we\n    // use null as a signal internally so it would lead it to be treated as a\n    // regular transition otherwise.\n    throw new Error(\n      'A Timeline is required as the first argument to startGestureTransition.',\n    );\n  }\n  const prevTransition = ReactSharedInternals.T;\n  const currentTransition: Transition = {} as any;\n  if (enableViewTransition) {\n    currentTransition.types = null;\n  }\n  // $FlowFixMe[constant-condition]\n  if (enableGestureTransition) {\n    currentTransition.gesture = provider;\n  }\n  if (enableTransitionTracing) {\n    currentTransition.name =\n      options !== undefined && options.name !== undefined ? options.name : null;\n    currentTransition.startTime = -1; // TODO: This should read the timestamp.\n  }\n  if (__DEV__) {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react/src/ReactStartTransition.js#L117-L153","documentation":"startGestureTransition requires a Timeline (gesture provider) as its first argument; null/undefined is rejected at runtime even though TypeScript also forbids it, because null is used internally as the signal for a regular transition and would silently change semantics.","triggerScenarios":"Calling startGestureTransition(null, scope) or startGestureTransition(undefined, scope) — e.g. the provider variable is optional and was not created before the call.","commonSituations":"Gesture/Timeline object created lazily or conditionally and not yet initialized when the transition starts; refactoring from an older signature where the provider was optional.","solutions":["Create the Timeline/gesture provider first and pass it as the first argument","Guard the call: if (timeline != null) startGestureTransition(timeline, ...)","Fix the construction order so the provider exists before any gesture transition starts"],"exampleFix":"// before\nconst timeline = maybeTimeline; // possibly null\nstartGestureTransition(timeline, () => { animate(); });\n\n// after\nif (timeline != null) {\n  startGestureTransition(timeline, () => { animate(); });\n}","handlingStrategy":"validation","validationCode":"// Validate the provider before starting the gesture transition\nif (timeline != null && typeof timeline === 'object') {\n  startGestureTransition(timeline, () => animate());\n} else {\n  animate(); // or start a regular startTransition\n}","typeGuard":"const isGestureProvider = (v: unknown): v is GestureProvider =>\n  v != null && typeof v === 'object';","tryCatchPattern":null,"preventionTips":["Create the Timeline before any code path that can start a gesture transition","Type the parameter as non-nullable GestureProvider so TypeScript catches null at compile time"],"tags":["gesture-transition","missing-argument","null-argument","experimental-api"],"backgroundTag":"missing-required-argument","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}