{"record":{"id":"0d7063f18d6c8f03","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-savechatflow-body-not","errorCode":null,"errorMessage":"Error: chatflowsController.saveChatflow - body not provided!","messagePattern":"Error: chatflowsController\\.saveChatflow - body not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":149,"sourceCode":"        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: chatflowsController.getChatflowById - workspace ${workspaceId} not found!`\n            )\n        }\n        const apiResponse = await chatflowsService.getChatflowById(req.params.id, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst saveChatflow = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.body) {\n            throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: chatflowsController.saveChatflow - body not provided!`)\n        }\n        const orgId = req.user?.activeOrganizationId\n        if (!orgId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: chatflowsController.saveChatflow - organization ${orgId} not found!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                `Error: chatflowsController.saveChatflow - workspace ${workspaceId} not found!`\n            )\n        }\n        const subscriptionId = req.user?.activeOrganizationSubscriptionId || ''\n        const body = req.body\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L131-L167","documentation":"Thrown by saveChatflow when req.body is falsy. PRECONDITION_FAILED (412) — the first guard, before org/workspace checks. Indicates the request reached the handler with no parsed JSON body at all (not just missing fields).","triggerScenarios":"POST /api/v1/chatflows with no body; Content-Type not set to application/json so body-parser produced nothing; client sent an empty body.","commonSituations":"Client forgot to send a JSON body; Content-Type header missing causing express to leave req.body undefined; misconfigured body-parser middleware; SDK serialization bug dropping the body.","solutions":["Ensure the request has Content-Type: application/json and a non-empty JSON body.","Verify express.json() (or body-parser) middleware is mounted before this route.","Client-side: assert the payload object is non-empty before sending."],"exampleFix":"// before\nawait api.post('/api/v1/chatflows')\n// after\nawait api.post('/api/v1/chatflows', { name, flowData, type }, {\n  headers: { 'Content-Type': 'application/json' }\n})","handlingStrategy":"validation","validationCode":"function hasBody(body: unknown): boolean {\n  return body !== undefined && body !== null && (typeof body !== 'object' || Object.keys(body as object).length > 0)\n}\nif (!hasBody(payload)) {\n  throw new Error('request body required to save chatflow')\n}","typeGuard":"function isNonEmptyObject(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && Object.keys(v).length > 0\n}","tryCatchPattern":null,"preventionTips":["Always set Content-Type: application/json on write requests.","Confirm express.json() middleware is mounted globally before routes.","Assert the payload object is non-empty before sending."],"tags":["flowise","express","body-validation","precondition","controller","create"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}