{"record":{"id":"1916d1950dab85c6","repo":"facebook/react","slug":"trying-to-call-a-function-from-use-server-but-th","errorCode":null,"errorMessage":"Trying to call a function from \"use server\" but the callServer option was not implemented in your router runtime.","messagePattern":"Trying to call a function from \"use server\" but the callServer option was not implemented in your router runtime\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-client/src/ReactFlightClient.js","lineNumber":2840,"sourceCode":"\n  if (tuple[0] === REACT_ELEMENT_TYPE) {\n    // TODO: Consider having React just directly accept these arrays as elements.\n    // Or even change the ReactElement type to be an array.\n    return createElement(\n      response,\n      tuple[1],\n      tuple[2],\n      tuple[3],\n      __DEV__ ? (tuple as any)[4] : null,\n      __DEV__ ? (tuple as any)[5] : null,\n      __DEV__ ? (tuple as any)[6] : 0,\n    );\n  }\n  return value;\n}\n\nfunction missingCall() {\n  throw new Error(\n    'Trying to call a function from \"use server\" but the callServer option ' +\n      'was not implemented in your router runtime.',\n  );\n}\n\nfunction markIOStarted(this: Response) {\n  this._debugIOStarted = true;\n}\n\nfunction ResponseInstance(\n  this: $FlowFixMe,\n  bundlerConfig: ServerConsumerModuleMap,\n  serverReferenceConfig: null | ServerManifest,\n  moduleLoading: ModuleLoading,\n  callServer: void | CallServerCallback,\n  encodeFormAction: void | EncodeFormActionCallback,\n  nonce: void | string,\n  temporaryReferences: void | TemporaryReferenceSet,","sourceCodeStart":2822,"sourceCodeEnd":2858,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-client/src/ReactFlightClient.js#L2822-L2858","documentation":"Server Functions ('use server' references) invoked from the client are executed through a callServer callback supplied in the options of createFromFetch/createFromReadableStream - normally wired up by your framework's router runtime. When no callServer was provided, React installs the missingCall placeholder, and the first attempt to actually invoke any server function throws this error explaining the missing option.","triggerScenarios":"Calling a Server Function (directly or .bind(...)) when the RSC payload was constructed without {callServer: fn}; using react-server-dom-webpack/client (react-client) directly in a custom router without providing callServer; unit tests that decode Flight payloads manually and then trigger a server reference.","commonSituations":"Building a custom RSC router instead of using a framework like Next.js; mixing versions where the callServer plumbing moved; test harnesses that create a client response with no options object; SSR setups where the server-side Flight client genuinely has no way to call back.","solutions":["Pass a callServer implementation: createFromFetch(fetch(url), {callServer}) where callServer POSTs to your server-action endpoint, sends encodeReply(args), and decodes the response with createFromFetch on the reply stream","If you are in a framework (Next.js, Waku, etc.), use its entry points so callServer is wired for you instead of calling raw client APIs","In tests, provide a stub callServer that resolves with a fixture instead of omitting the option"],"exampleFix":"// before\nconst data = createFromFetch(fetch('/route'));\n// ...later: serverFn() -> throws missingCall\n\n// after\nconst callServer = async (id, args) => {\n  const body = await encodeReply(args);\n  const res = await fetch('/server-action', {method: 'POST', body});\n  return createFromFetch(Promise.resolve(res), {callServer}); // re-thread for nested calls\n};\nconst data = createFromFetch(fetch('/route'), {callServer});","handlingStrategy":"validation","validationCode":"// Fail fast at setup instead of on the first server-function call\nfunction assertCallServer(options) {\n  if (typeof options.callServer !== 'function') {\n    throw new Error('Configuration error: callServer required - this app invokes Server Functions');\n  }\n}\nconst payload = createFromFetch(fetchPromise, {callServer});","typeGuard":"type CallServer = (id: any, args: any[]) => Promise<any>;\nconst hasCallServer = (o: unknown): o is {callServer: CallServer} =>\n  typeof (o as any)?.callServer === 'function';","tryCatchPattern":null,"preventionTips":["Always create Flight clients with an explicit options object that includes callServer","Prefer framework entry points that wire callServer for you","In tests, pass a stub callServer returning fixtures","Add a boot-time assertion so misconfiguration surfaces immediately"],"tags":["rsc","server-functions","callserver","flight","configuration"],"backgroundTag":"missing-callserver-option","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}