{"record":{"id":"f532f691b12baa30","repo":"facebook/react","slug":"server-actions-must-be-functions-f532f6","errorCode":null,"errorMessage":"Server actions must be functions","messagePattern":"Server actions must be functions","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js","lineNumber":803,"sourceCode":"export function decodeAction<T>(body: FormData): Promise<() => T> | null {\n  return decodeActionImpl(body, serverManifest);\n}\n\nexport function decodeFormState<S>(\n  actionResult: S,\n  body: FormData,\n): Promise<ReactFormState<S, ServerReferenceId> | null> {\n  return decodeFormStateImpl(actionResult, body, serverManifest);\n}\n\nexport function loadServerAction<F: (...any[]) => any>(id: string): Promise<F> {\n  const reference = resolveServerReference<any>(serverManifest, id);\n  return Promise.resolve(reference)\n    .then(() => preloadModule(reference))\n    .then(() => {\n      const fn = requireModule(reference);\n      if (typeof fn !== 'function') {\n        throw new Error('Server actions must be functions');\n      }\n      return fn;\n    });\n}\n","sourceCodeStart":785,"sourceCodeEnd":808,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-parcel/src/server/ReactFlightDOMServerNode.js#L785-L808","documentation":"loadServerAction() resolves a server action id through the parcel server manifest, preloads its chunk, then requires it. Files marked 'use server' must export only functions, so when requireModule(reference) returns anything other than a function (undefined binding, object, class), the returned promise rejects with this error.","triggerScenarios":"A 'use server' module exporting a non-function (export const LIMITS = {...}, export default someObject, a class), or a manifest id mapping to a renamed/tree-shaken export so the required binding resolves to undefined.","commonSituations":"Adding constants or config objects to a 'use server' file; mixing default/class exports into action modules; stale server manifest after renaming exports while the bundler cache persists.","solutions":["Make every export in the 'use server' file an async function","Move constants/types/classes to a plain server-side module without 'use server' and import them from the action file","Clear the bundler cache and rebuild so the server manifest maps each action id to a live export"],"exampleFix":"// before ('use server' file)\n'use server';\nexport const LIMITS = {max: 10}; // non-function export\nexport async function addItem(item) {...}\n\n// after\n// limits.js (no 'use server'): export const LIMITS = {max: 10};\n'use server';\nexport async function addItem(item) {...}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const fn = await loadServerAction(id);\n} catch (e) {\n  logger.error(`Server action ${id} failed to load: ${e.message}`);\n  throw e;\n}","preventionTips":["Lint 'use server' files so every export is an async function","Keep constants and classes out of action modules","Rebuild both bundles after renaming exports referenced by server actions"],"tags":["server-actions","use-server","parcel","module-exports"],"backgroundTag":"server-action-invalid-export","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}