FlowiseAI/Flowise · info · InternalFlowiseError
Error: chatMessagesController.createChatMessage - request bo
Error message
Error: chatMessagesController.createChatMessage - request body not provided!
What it means
Declared in chatMessagesController.createChatMessage (HTTP 412 when req.body is falsy), but the route that would expose it is COMMENTED OUT: routes/chat-messages/index.ts:8 reads '// router.post(['/', '/:id'], chatMessageController.createChatMessage)' with the note 'NOTE: Unused route'. A repo-wide search finds createChatMessage registered nowhere else (internal-chat-messages only wires getAllInternalChatMessages). So through the active REST API this guard is effectively DEAD CODE and cannot be triggered; it would only fire if the route is re-enabled or the controller method is invoked directly (e.g., in a test). If re-enabled it would mount at POST /api/v1/chatmessage (note the singular 'chatmessage' prefix).
Source
Thrown at packages/server/src/controllers/chat-messages/index.ts:39
) {
feedbackTypeFilters = [ChatMessageRatingType.THUMBS_UP, ChatMessageRatingType.THUMBS_DOWN]
} else if (feedbackTypeFilterArray.includes(ChatMessageRatingType.THUMBS_UP)) {
feedbackTypeFilters = [ChatMessageRatingType.THUMBS_UP]
} else if (feedbackTypeFilterArray.includes(ChatMessageRatingType.THUMBS_DOWN)) {
feedbackTypeFilters = [ChatMessageRatingType.THUMBS_DOWN]
} else {
feedbackTypeFilters = undefined
}
return feedbackTypeFilters
} catch (e) {
return _feedbackTypeFilters
}
}
const createChatMessage = async (req: Request, res: Response, next: NextFunction) => {
try {
if (!req.body) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
'Error: chatMessagesController.createChatMessage - request body not provided!'
)
}
const apiResponse = await chatMessagesService.createChatMessage(req.body)
return res.json(parseAPIResponse(apiResponse))
} catch (error) {
next(error)
}
}
const getAllChatMessages = async (req: Request, res: Response, next: NextFunction) => {
try {
const _chatTypes = req.query?.chatType as string | undefined
let chatTypes: ChatType[] | undefined
if (_chatTypes) {
try {
if (Array.isArray(_chatTypes)) {View on GitHub (pinned to abe4a8601a)
Solutions
- Treat absence of this error in production as expected; if you need createChatMessage, uncomment routes/chat-messages/index.ts:8 and ensure callers POST JSON with Content-Type: application/json.
- If you are writing a controller-level unit test, construct req as { body: {...} } rather than {}.
- If you do NOT need the route, leave it commented and remove the dead handler to reduce confusion.
Example fix
// test/direct invocation fix: pass a parsed body
// before
const req = { } as any
await chatMessagesController.createChatMessage(req, res, next) // -> 412
// after
const req = { body: { chatflowid: 'cf-1', ... } } as any
await chatMessagesController.createChatMessage(req, res, next) Defensive patterns
Strategy: validation
Validate before calling
// Only relevant if you re-enable the (currently commented) POST route or call the controller directly.
function createChatMessage(body: unknown) {
if (!body || typeof body !== 'object') {
throw new Error('createChatMessage requires a JSON body')
}
return fetch(`${BASE}/api/v1/chatmessage`, {
method: 'POST',
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
- Remember this route is currently disabled (commented in routes/chat-messages/index.ts:8); you will not hit this error over HTTP unless you re-enable it.
- If you re-enable it, require Content-Type: application/json and a non-empty JSON body.
- In unit tests invoking the controller directly, always construct req.body.
When it happens
Trigger: Not reachable via the shipped REST router. To trigger it you must either uncomment the POST route in routes/chat-messages/index.ts:8, re-register POST /api/v1/chatmessage against this controller elsewhere, or call chatMessagesController.createChatMessage directly in a test with a request whose body was not parsed.
Common situations: A developer investigating this string in logs will not see it from normal HTTP traffic. It appears in unit tests that exercise the controller directly without constructing req.body, or after someone re-enables the unused POST route without sending a JSON body.
Related errors
- Error: assistantsController.createAssistant - body not provi
- Error: assistantsController.updateAssistant - body not provi
- Error: assistantsController.generateAssistantInstruction - b
- Error: chatMessageController.getAllChatMessages - id not pro
- Error: chatMessagesController.removeAllChatMessages - id not
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/cd8e481fa5bbedb5.
Report an issue: GitHub.