{"record":{"id":"344fe41c77d93ba5","repo":"remix-run/react-router","slug":"cannot-handle-enhanced-server-action-without-decod","errorCode":null,"errorMessage":"Cannot handle enhanced server action without decodeReply and loadServerAction functions","messagePattern":"Cannot handle enhanced server action without decodeReply and loadServerAction functions","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-router/lib/rsc/server.rsc.ts","lineNumber":679,"sourceCode":"      formState?: ReactFormState;\n    }\n  | Response\n  | undefined\n> {\n  const getRevalidationRequest = () =>\n    new Request(request.url, {\n      method: \"GET\",\n      headers: request.headers,\n      signal: request.signal,\n    });\n\n  const isFormRequest = canDecodeWithFormData(\n    request.headers.get(\"Content-Type\"),\n  );\n  const actionId = request.headers.get(\"rsc-action-id\");\n  if (actionId) {\n    if (!decodeReply || !loadServerAction) {\n      throw new Error(\n        \"Cannot handle enhanced server action without decodeReply and loadServerAction functions\",\n      );\n    }\n\n    const reply = isFormRequest\n      ? await request.formData()\n      : await request.text();\n\n    const actionArgs = await decodeReply(reply, { temporaryReferences });\n    const action = await loadServerAction(actionId);\n    const serverAction = action.bind(null, ...actionArgs);\n\n    let actionResult = Promise.resolve(serverAction());\n    try {\n      // Wait for actions to finish regardless of state\n      await actionResult;\n    } catch (error) {\n      if (isResponse(error)) {","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/remix-run/react-router/blob/1fd704a7dabcbe3ae09d7387b460e6acaba30ec1/packages/react-router/lib/rsc/server.rsc.ts#L661-L697","documentation":"`handleServerAction` received a request carrying an `rsc-action-id` header (an enhanced/server-component action call) but the React Server functions `decodeReply` and/or `loadServerAction` were not provided. Without them the runtime cannot decode the action arguments or look up the action by id.","triggerScenarios":"Calling `handleServerAction(request, ...)` (or wiring a custom server action endpoint) without passing the `decodeReply` and `loadServerAction` functions sourced from `react-server-dom-xyz/server`. The request still reached this code path because of the `rsc-action-id` header.","commonSituations":"Building a custom RSC server adapter and forgetting to forward the rsd functions; partial RSC setup where only some handlers are wired; a misconfigured `createRSCRequestHandler` that drops the options.","solutions":["Pass `decodeReply` and `loadServerAction` from your `react-server-dom-*/server` module into `handleServerAction`/`createRSCRequestHandler`.","Confirm the rsd bundle version matches the React Router RSC runtime version.","If you don't intend to support enhanced server actions, ensure clients don't send the `rsc-action-id` header."],"exampleFix":"// before\nhandleServerAction({ request });\n\n// after\nimport { decodeReply, loadServerAction } from 'react-server-dom-webpack/server';\nhandleServerAction({ request, decodeReply, loadServerAction });","handlingStrategy":"validation","validationCode":"function assertRscFns(opts: { decodeReply?: unknown; loadServerAction?: unknown }) {\n  if (!opts.decodeReply || !opts.loadServerAction) {\n    throw new Error('RSC server actions require decodeReply and loadServerAction');\n  }\n}\nassertRscFns({ decodeReply, loadServerAction });","typeGuard":"function hasEnhancedActionFns(o: any): o is { decodeReply: Function; loadServerAction: Function } {\n  return typeof o.decodeReply === 'function' && typeof o.loadServerAction === 'function';\n}","tryCatchPattern":null,"preventionTips":["Always wire all four decode functions (decodeReply, decodeAction, decodeFormState, loadServerAction) when constructing the RSC handler.","Pin rsd version to match the React Router RSC runtime.","Reject requests with `rsc-action-id` at the edge if you don't support enhanced actions."],"tags":["rsc","server-actions","config","decode"],"backgroundTag":null,"analyzedSha":"1fd704a7dabcbe3ae09d7387b460e6acaba30ec1","analyzedAt":"2026-08-12T13:54:57.804Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}