FlowiseAI/Flowise · warning · InternalFlowiseError

Error: chatMessagesController.removeAllChatMessages - id not

Error message

Error: chatMessagesController.removeAllChatMessages - id not provided!

What it means

Thrown by removeAllChatMessages with HTTP 412 when req.params is undefined or req.params.id is falsy. Mounted via routes/chat-messages/index.ts:25 as DELETE ['/', '/:id'] under the singular /chatmessage prefix, i.e. DELETE /api/v1/chatmessage/:id. This is the first of three sequential guards (id, then organization, then workspace). As with the GET path, /chat-messages (plural) yields an Express 404 rather than this error.

Source

Thrown at packages/server/src/controllers/chat-messages/index.ts:149

            sessionId,
            startDate,
            endDate,
            messageId,
            feedback,
            feedbackTypeFilters,
            activeWorkspaceId
        )
        return res.json(parseAPIResponse(apiResponse))
    } catch (error) {
        next(error)
    }
}

const removeAllChatMessages = async (req: Request, res: Response, next: NextFunction) => {
    try {
        const appServer = getRunningExpressApp()
        if (typeof req.params === 'undefined' || !req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                'Error: chatMessagesController.removeAllChatMessages - id not provided!'
            )
        }
        const orgId = req.user?.activeOrganizationId
        if (!orgId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: chatMessagesController.removeAllChatMessages - organization ${orgId} not found!`
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: chatMessagesController.removeAllChatMessages - workspace ${workspaceId} not found!`
            )
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Call DELETE /api/v1/chatmessage/<id> with the chatflow id (singular prefix).
  2. Guard the id is a non-empty string before issuing the DELETE.

Example fix

// before
await fetch(`${BASE}/api/v1/chatmessage/`, { method: 'DELETE', headers })

// after
if (!chatflowId) throw new Error('chatflow id required')
await fetch(`${BASE}/api/v1/chatmessage/${encodeURIComponent(chatflowId)}`, { method: 'DELETE', headers })
Defensive patterns

Strategy: validation

Validate before calling

function assertId(id: unknown): string {
  if (typeof id !== 'string' || id.trim() === '') {
    throw new Error('chatflow id is required')
  }
  return id
}
const id = assertId(selectedChatflowId)
await fetch(`${BASE}/api/v1/chatmessage/${encodeURIComponent(id)}`, { method: 'DELETE', headers })

Type guard

const isNonEmptyString = (v: unknown): v is string =>
  typeof v === 'string' && v.trim().length > 0

Prevention

When it happens

Trigger: DELETE /api/v1/chatmessage/ (root form, no id). A 'clear messages' action invoked before a chatflow id is set. A cleanup script DELETE-ing the collection root.

Common situations: UI 'clear chat history' button with no chatflow selected; wrong path prefix ('chat-messages' vs 'chatmessage'); test iterating an empty id list.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/0edc60c479e92ccb. Report an issue: GitHub.