facebook/react · error · Error

Trying to call a function from "use server" but the callServ

Error message

Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.

What it means

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.

Source

Thrown at packages/react-client/src/ReactFlightClient.js:2840

  if (tuple[0] === REACT_ELEMENT_TYPE) {
    // TODO: Consider having React just directly accept these arrays as elements.
    // Or even change the ReactElement type to be an array.
    return createElement(
      response,
      tuple[1],
      tuple[2],
      tuple[3],
      __DEV__ ? (tuple as any)[4] : null,
      __DEV__ ? (tuple as any)[5] : null,
      __DEV__ ? (tuple as any)[6] : 0,
    );
  }
  return value;
}

function missingCall() {
  throw new Error(
    'Trying to call a function from "use server" but the callServer option ' +
      'was not implemented in your router runtime.',
  );
}

function markIOStarted(this: Response) {
  this._debugIOStarted = true;
}

function ResponseInstance(
  this: $FlowFixMe,
  bundlerConfig: ServerConsumerModuleMap,
  serverReferenceConfig: null | ServerManifest,
  moduleLoading: ModuleLoading,
  callServer: void | CallServerCallback,
  encodeFormAction: void | EncodeFormActionCallback,
  nonce: void | string,
  temporaryReferences: void | TemporaryReferenceSet,

View on GitHub (pinned to eafeac097b)

Solutions

  1. 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
  2. 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
  3. In tests, provide a stub callServer that resolves with a fixture instead of omitting the option

Example fix

// before
const data = createFromFetch(fetch('/route'));
// ...later: serverFn() -> throws missingCall

// after
const callServer = async (id, args) => {
  const body = await encodeReply(args);
  const res = await fetch('/server-action', {method: 'POST', body});
  return createFromFetch(Promise.resolve(res), {callServer}); // re-thread for nested calls
};
const data = createFromFetch(fetch('/route'), {callServer});
Defensive patterns

Strategy: validation

Validate before calling

// Fail fast at setup instead of on the first server-function call
function assertCallServer(options) {
  if (typeof options.callServer !== 'function') {
    throw new Error('Configuration error: callServer required - this app invokes Server Functions');
  }
}
const payload = createFromFetch(fetchPromise, {callServer});

Type guard

type CallServer = (id: any, args: any[]) => Promise<any>;
const hasCallServer = (o: unknown): o is {callServer: CallServer} =>
  typeof (o as any)?.callServer === 'function';

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/1916d1950dab85c6. Report an issue: GitHub.