FlowiseAI/Flowise · error · InternalFlowiseError
Error: chatflowsController.saveChatflow - body not provided!
Error message
Error: chatflowsController.saveChatflow - body not provided!
What it means
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).
Source
Thrown at packages/server/src/controllers/chatflows/index.ts:149
}
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: chatflowsController.getChatflowById - workspace ${workspaceId} not found!`
)
}
const apiResponse = await chatflowsService.getChatflowById(req.params.id, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
const saveChatflow = async (req: Request, res: Response, next: NextFunction) => {
try {
if (!req.body) {
throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: chatflowsController.saveChatflow - body not provided!`)
}
const orgId = req.user?.activeOrganizationId
if (!orgId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: chatflowsController.saveChatflow - organization ${orgId} not found!`
)
}
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: chatflowsController.saveChatflow - workspace ${workspaceId} not found!`
)
}
const subscriptionId = req.user?.activeOrganizationSubscriptionId || ''
const body = req.body
View on GitHub (pinned to abe4a8601a)
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.
Example fix
// before
await api.post('/api/v1/chatflows')
// after
await api.post('/api/v1/chatflows', { name, flowData, type }, {
headers: { 'Content-Type': 'application/json' }
}) Defensive patterns
Strategy: validation
Validate before calling
function hasBody(body: unknown): boolean {
return body !== undefined && body !== null && (typeof body !== 'object' || Object.keys(body as object).length > 0)
}
if (!hasBody(payload)) {
throw new Error('request body required to save chatflow')
} Type guard
function isNonEmptyObject(v: unknown): v is Record<string, unknown> {
return typeof v === 'object' && v !== null && Object.keys(v).length > 0
} Prevention
- 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.
When it happens
Trigger: POST /api/v1/chatflows with no body; Content-Type not set to application/json so body-parser produced nothing; client sent an empty body.
Common situations: 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.
Related errors
- Error: chatMessagesController.abortChatMessage - chatflowid
- Error: chatflowsController.checkIfChatflowIsValidForStreamin
- Error: chatflowsController.checkIfChatflowIsValidForUploads
- Error: chatflowsController.deleteChatflow - id not provided!
- Error: chatflowsController.getChatflowByApiKey - apikey not
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/0d7063f18d6c8f03.
Report an issue: GitHub.