{"record":{"id":"b5a9daac5f2a90cf","repo":"facebook/react","slug":"type-typeof-value-is-not-supported-as-an-argume","errorCode":null,"errorMessage":"Type ${typeof value} is not supported as an argument to a Server Function.","messagePattern":"Type (.+?) is not supported as an argument to a Server Function\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-client/src/ReactFlightReplyClient.js","lineNumber":877,"sourceCode":"          // through the property name inside that parent.\n          const reference = parentReference + ':' + key;\n          // Store this object so that the server can refer to it later in responses.\n          writeTemporaryReference(temporaryReferences, reference, value);\n          return serializeTemporaryReferenceMarker();\n        }\n      }\n      throw new Error(\n        'Symbols cannot be passed to a Server Function without a ' +\n          'temporary reference set. Pass a TemporaryReferenceSet to the options.' +\n          (__DEV__ ? describeObjectForErrorMessage(parent, key) : ''),\n      );\n    }\n\n    if (typeof value === 'bigint') {\n      return serializeBigInt(value);\n    }\n\n    throw new Error(\n      `Type ${typeof value} is not supported as an argument to a Server Function.`,\n    );\n  }\n\n  function serializeModel(model: ReactServerValue, id: number): string {\n    if (typeof model === 'object' && model !== null) {\n      const reference = serializeByValueID(id);\n      writtenObjects.set(model, reference);\n      if (temporaryReferences !== undefined) {\n        // Store this object so that the server can refer to it later in responses.\n        writeTemporaryReference(temporaryReferences, reference, model);\n      }\n    }\n    modelRoot = model;\n    // $FlowFixMe[incompatible-type] it's not going to be undefined because we'll encode it.\n    return JSON.stringify(model, resolveToJSON);\n  }\n","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-client/src/ReactFlightReplyClient.js#L859-L895","documentation":"This is the final catch-all at the end of serializeArgument in the reply serializer. Every supported category has been checked by this point - primitives, elements, lazy, server references, client functions, symbols, bigint, plain objects and built-ins - so reaching the last throw means the value's typeof matches no supported slot. In practice this fires only for exotic values whose reported typeof is misleading (e.g. document.all reporting 'undefined', cross-realm/VM objects) or future host exotica; for ordinary JS values the earlier branches throw their own specific messages.","triggerScenarios":"Passing host exotica like document.all, values from another VM realm/context whose typeof is inconsistent, or objects with spoofed/mutated prototypes engineered to dodge the earlier branches; any argument that slips past every typed branch of serializeArgument.","commonSituations":"Sending DOM/window objects that masquerade as primitives; test doubles and Proxy objects with exotic behavior; serializing values produced in node:vm or jsdom realms; almost never seen with plain application data - if you see it, an unusual object reached the boundary.","solutions":["Dry-run encodeReply(args) locally inside try/catch to identify which argument value falls through, then replace it with a serializable representation","Convert exotic values to plain data before the call (e.g. String(el.id), a plain DTO) or pass an ID and rehydrate on the server","If realm-crossing objects are involved, reconstruct the value in the main realm first","Report genuinely unsupported value types to the React team if a legitimate use case hits the catch-all"],"exampleFix":"// before\nawait saveSelection({node: document.all, ok: true}); // exotic typeof -> catch-all throw\n\n// after\nawait saveSelection({nodeId: el?.id ?? null, ok: true}); // plain data only","handlingStrategy":"try-catch","validationCode":"// Dry-run the serialization locally to catch exotic values before the network call\nimport {encodeReply} from 'react-server-dom-webpack/client';\nasync function assertReplyEncodable(args: unknown) {\n  try {\n    await encodeReply(args);\n  } catch (e) {\n    throw new Error(`Arguments not serializable for Server Function call: ${(e as Error).message}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await myServerFunction(args);\n} catch (e) {\n  if (e instanceof Error && /is not supported as an argument to a Server Function/.test(e.message)) {\n    // Re-run encodeReply(args) locally to locate the offending value,\n    // replace it with plain data or an ID, then retry the call once\n  } else throw e;\n}","preventionTips":["Dry-run encodeReply over complex args during development","Keep Server Function payloads limited to plain data, built-ins, and IDs","Avoid forwarding host objects, DOM nodes, or cross-realm values into actions","Log failing argument shapes once to build a project-specific allowlist"],"tags":["server-functions","serialization","unsupported-type","rsc","flight"],"backgroundTag":"non-serializable-argument","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}