{"record":{"id":"835af17a5464b7b7","repo":"FlowiseAI/Flowise","slug":"error-chatmessagescontroller-abortchatmessage-c","errorCode":null,"errorMessage":"Error: chatMessagesController.abortChatMessage - chatflowid or chatid not provided!","messagePattern":"Error: chatMessagesController\\.abortChatMessage - chatflowid or chatid not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/chat-messages/index.ts","lineNumber":310,"sourceCode":"            const apiResponse = await chatMessagesService.removeAllChatMessages(\n                chatId,\n                chatflowid,\n                deleteOptions,\n                orgId,\n                workspaceId,\n                appServer.usageCacheManager\n            )\n            return res.json(apiResponse)\n        }\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst abortChatMessage = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.chatflowid || !req.params.chatid) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatMessagesController.abortChatMessage - chatflowid or chatid not provided!`\n            )\n        }\n        await chatMessagesService.abortChatMessage(req.params.chatid, req.params.chatflowid)\n        return res.json({ status: 200, message: 'Chat message aborted' })\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst parseAPIResponse = (apiResponse: ChatMessage | ChatMessage[]): ChatMessage | ChatMessage[] => {\n    const parseResponse = (response: ChatMessage): ChatMessage => {\n        const parsedResponse = { ...response }\n\n        try {\n            if (parsedResponse.sourceDocuments) {\n                parsedResponse.sourceDocuments = JSON.parse(parsedResponse.sourceDocuments)","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chat-messages/index.ts#L292-L328","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the actual request URL — both chatflowid and chatid path segments must be non-empty.","Fix the client template: guard that both ids are truthy before issuing the request.","Confirm the server route definition matches the param names the client uses (chatflowid, chatid).","Add a client-side assert/throw with a clearer message before calling the endpoint."],"exampleFix":"// before\nawait api.post(`/api/v1/chatmessages/abort/${chatflowid}/${chatid}`)\n// after\nif (!chatflowid || !chatid) throw new Error('abort requires both chatflowid and chatid')\nawait api.post(`/api/v1/chatmessages/abort/${chatflowid}/${chatid}`)","handlingStrategy":"validation","validationCode":"function validAbortParams(p: { chatflowid?: string; chatid?: string }): boolean {\n  return Boolean(p && p.chatflowid && p.chatid)\n}\nif (!validAbortParams(params)) throw new Error('abort requires chatflowid and chatid')","typeGuard":"function isAbortParams(p: unknown): p is { chatflowid: string; chatid: string } {\n  return typeof p === 'object' && p !== null\n    && typeof (p as any).chatflowid === 'string' && (p as any).chatflowid.length > 0\n    && typeof (p as any).chatid === 'string' && (p as any).chatid.length > 0\n}","tryCatchPattern":null,"preventionTips":["Validate both ids are non-empty strings before building the request URL.","Centralize abort-URL construction in one helper to avoid template typos.","Pin the SDK/server version so param names stay stable.","Log the outbound URL in dev to catch undefined segments early."],"tags":["flowise","express","params-validation","precondition","controller"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}