FlowiseAI/Flowise · warning · InternalFlowiseError
Error: assistantsController.updateAssistant - body not provi
Error message
Error: assistantsController.updateAssistant - body not provided!
What it means
Thrown by updateAssistant with HTTP 412 after the id guard passes, when req.body is falsy. As with createAssistant, this means the JSON body parser did not populate req.body — usually a missing Content-Type: application/json or an empty body.
Source
Thrown at packages/server/src/controllers/assistants/index.ts:116
)
}
const apiResponse = await assistantsService.getAssistantById(req.params.id, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
const updateAssistant = async (req: Request, res: Response, next: NextFunction) => {
try {
if (typeof req.params === 'undefined' || !req.params.id) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
`Error: assistantsController.updateAssistant - id not provided!`
)
}
if (!req.body) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
`Error: assistantsController.updateAssistant - body not provided!`
)
}
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: assistantsController.updateAssistant - workspace ${workspaceId} not found!`
)
}
const apiResponse = await assistantsService.updateAssistant(req.params.id, req.body, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
View on GitHub (pinned to abe4a8601a)
Solutions
- Send Content-Type: application/json with a JSON body on the PUT.
- Ensure the body is a non-empty object (it is passed straight to the service).
- Confirm express.json() runs before this router.
Example fix
// before
await fetch(`${BASE}/api/v1/assistants/${id}`, { method: 'PUT', headers: authHeaders })
// after
await fetch(`${BASE}/api/v1/assistants/${id}`, {
method: 'PUT',
headers: { ...authHeaders, 'Content-Type': 'application/json' },
body: JSON.stringify(changes)
}) Defensive patterns
Strategy: validation
Validate before calling
function updateAssistant(id: string, body: unknown) {
if (!body || typeof body !== 'object') {
throw new Error('updateAssistant requires a JSON body')
}
return fetch(`${BASE}/api/v1/assistants/${encodeURIComponent(id)}`, {
method: 'PUT',
headers: { ...authHeaders, 'Content-Type': 'application/json' },
body: JSON.stringify(body)
})
} Type guard
const isJsonObject = (b: unknown): b is Record<string, unknown> => !!b && typeof b === 'object' && !Array.isArray(b)
Prevention
- Always send Content-Type: application/json on PUT.
- Centralize PUT calls behind a helper that forces JSON content type and a non-empty body.
- Confirm express.json() runs before the v1 router.
When it happens
Trigger: PUT /api/v1/assistants/<id> with no body or a non-JSON content type, so req.body is undefined.
Common situations: Client sent the update as form-encoded or with no Content-Type; proxy stripped Content-Type; body serialization bug producing an empty body.
Related errors
- Error: assistantsController.createAssistant - body not provi
- Error: assistantsController.generateAssistantInstruction - b
- Error: assistantsController.deleteAssistant - id not provide
- Error: assistantsController.getAssistantById - id not provid
- Error: assistantsController.updateAssistant - id not provide
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/7f5bacddb903527a.
Report an issue: GitHub.