FlowiseAI/Flowise · error · InternalFlowiseError

Error: chatMessagesController.abortChatMessage - chatflowid

Error message

Error: chatMessagesController.abortChatMessage - chatflowid or chatid not provided!

What it means

Thrown by abortChatMessage when either req.params.chatflowid or req.params.chatid is missing. The controller combines both checks into one PRECONDITION_FAILED (412) error, so the message does not distinguish which one is absent. It is a pure route-parameter validation guard before any service call.

Source

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

            const apiResponse = await chatMessagesService.removeAllChatMessages(
                chatId,
                chatflowid,
                deleteOptions,
                orgId,
                workspaceId,
                appServer.usageCacheManager
            )
            return res.json(apiResponse)
        }
    } catch (error) {
        next(error)
    }
}

const abortChatMessage = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (typeof req.params === 'undefined' || !req.params.chatflowid || !req.params.chatid) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: chatMessagesController.abortChatMessage - chatflowid or chatid not provided!`
            )
        }
        await chatMessagesService.abortChatMessage(req.params.chatid, req.params.chatflowid)
        return res.json({ status: 200, message: 'Chat message aborted' })
    } catch (error) {
        next(error)
    }
}

const parseAPIResponse = (apiResponse: ChatMessage | ChatMessage[]): ChatMessage | ChatMessage[] => {
    const parseResponse = (response: ChatMessage): ChatMessage => {
        const parsedResponse = { ...response }

        try {
            if (parsedResponse.sourceDocuments) {
                parsedResponse.sourceDocuments = JSON.parse(parsedResponse.sourceDocuments)

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Inspect the actual request URL — both chatflowid and chatid path segments must be non-empty.
  2. Fix the client template: guard that both ids are truthy before issuing the request.
  3. Confirm the server route definition matches the param names the client uses (chatflowid, chatid).
  4. Add a client-side assert/throw with a clearer message before calling the endpoint.

Example fix

// before
await api.post(`/api/v1/chatmessages/abort/${chatflowid}/${chatid}`)
// after
if (!chatflowid || !chatid) throw new Error('abort requires both chatflowid and chatid')
await api.post(`/api/v1/chatmessages/abort/${chatflowid}/${chatid}`)
Defensive patterns

Strategy: validation

Validate before calling

function validAbortParams(p: { chatflowid?: string; chatid?: string }): boolean {
  return Boolean(p && p.chatflowid && p.chatid)
}
if (!validAbortParams(params)) throw new Error('abort requires chatflowid and chatid')

Type guard

function isAbortParams(p: unknown): p is { chatflowid: string; chatid: string } {
  return typeof p === 'object' && p !== null
    && typeof (p as any).chatflowid === 'string' && (p as any).chatflowid.length > 0
    && typeof (p as any).chatid === 'string' && (p as any).chatid.length > 0
}

Prevention

When it happens

Trigger: Calling POST/GET on the abort endpoint with a URL missing one path segment, e.g. /api/v1/chatmessages/abort/<only-one-id>. Also triggered by a misconfigured reverse-proxy rewrite that strips a path param, or a client constructing the URL with an undefined variable.

Common situations: Frontend uses a template literal where one id variable is undefined (e.g. `\`/abort/${chatflowid}/${chatid}\`` with chatid not yet set); route definition changed to expect different param names than the client sends; SDK upgraded and param order renamed.

Related errors


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