FlowiseAI/Flowise · warning · InternalFlowiseError

Error: chatMessageController.getAllChatMessages - id not pro

Error message

Error: chatMessageController.getAllChatMessages - id not provided!

What it means

Thrown by getAllChatMessages with HTTP 412 when req.params is undefined or req.params.id is falsy. Mounted via routes/chat-messages/index.ts:11 as GET ['/', '/:id'] under the /chatmessage prefix (routes/index.ts:83 — note the SINGULAR 'chatmessage', not 'chat-messages'), i.e. GET /api/v1/chatmessage/:id. Two gotchas: (1) clients using /api/v1/chat-messages/<id> get an Express 404, not this error; (2) the id guard sits at line 83, AFTER several req.query reads (messageId, startDate, endDate, feedback, feedbackType, page, limit) — those reads are side-effect-free so ordering does not change the result, but it is an unusual code layout.

Source

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

        }
        const activeWorkspaceId = req.user?.activeWorkspaceId
        const sortOrder = req.query?.order as string | undefined
        const chatId = req.query?.chatId as string | undefined
        const memoryType = req.query?.memoryType as string | undefined
        const sessionId = req.query?.sessionId as string | undefined
        const messageId = req.query?.messageId as string | undefined
        const startDate = req.query?.startDate as string | undefined
        const endDate = req.query?.endDate as string | undefined
        const feedback = req.query?.feedback as boolean | undefined

        const { page, limit } = getPageAndLimitParams(req)

        let feedbackTypeFilters = req.query?.feedbackType as ChatMessageRatingType[] | undefined
        if (feedbackTypeFilters) {
            feedbackTypeFilters = getFeedbackTypeFilters(feedbackTypeFilters)
        }
        if (typeof req.params === 'undefined' || !req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: chatMessageController.getAllChatMessages - id not provided!`
            )
        }
        const apiResponse = await chatMessagesService.getAllChatMessages(
            req.params.id,
            chatTypes,
            sortOrder,
            chatId,
            memoryType,
            sessionId,
            startDate,
            endDate,
            messageId,
            feedback,
            feedbackTypeFilters,
            activeWorkspaceId,
            page,

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Call GET /api/v1/chatmessage/<id> with the chatflow id (use the singular 'chatmessage' prefix).
  2. Guard the id is a non-empty string before building the URL.
  3. If integrating, double-check the exact mount prefix — it is /chatmessage, not /chat-messages.

Example fix

// before (wrong prefix + empty id)
await fetch(`${BASE}/api/v1/chat-messages/`, { headers })

// after (correct singular prefix, concrete id)
if (!chatflowId) throw new Error('chatflow id required')
await fetch(`${BASE}/api/v1/chatmessage/${encodeURIComponent(chatflowId)}`, { 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)}`, { headers }) // singular 'chatmessage'

Type guard

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

Prevention

When it happens

Trigger: GET /api/v1/chatmessage/ (root form, no id) — e.g. a client that lists messages for a chatflow but builds the URL with an empty chatflow id. A caller who omits the final id segment entirely. (Using the plural /chat-messages path yields a routing 404 instead.)

Common situations: Chat-history panel loaded before a chatflow id is selected; client using the wrong path segment name ('chat-messages' vs 'chatmessage'); test hitting the collection root.

Related errors


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