{"record":{"id":"4decce8f01f39d8c","repo":"FlowiseAI/Flowise","slug":"error-chatmessagecontroller-getallchatmessages","errorCode":null,"errorMessage":"Error: chatMessageController.getAllChatMessages - id not provided!","messagePattern":"Error: chatMessageController\\.getAllChatMessages - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"warning","filePath":"packages/server/src/controllers/chat-messages/index.ts","lineNumber":83,"sourceCode":"        }\n        const activeWorkspaceId = req.user?.activeWorkspaceId\n        const sortOrder = req.query?.order as string | undefined\n        const chatId = req.query?.chatId as string | undefined\n        const memoryType = req.query?.memoryType as string | undefined\n        const sessionId = req.query?.sessionId as string | undefined\n        const messageId = req.query?.messageId as string | undefined\n        const startDate = req.query?.startDate as string | undefined\n        const endDate = req.query?.endDate as string | undefined\n        const feedback = req.query?.feedback as boolean | undefined\n\n        const { page, limit } = getPageAndLimitParams(req)\n\n        let feedbackTypeFilters = req.query?.feedbackType as ChatMessageRatingType[] | undefined\n        if (feedbackTypeFilters) {\n            feedbackTypeFilters = getFeedbackTypeFilters(feedbackTypeFilters)\n        }\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatMessageController.getAllChatMessages - id not provided!`\n            )\n        }\n        const apiResponse = await chatMessagesService.getAllChatMessages(\n            req.params.id,\n            chatTypes,\n            sortOrder,\n            chatId,\n            memoryType,\n            sessionId,\n            startDate,\n            endDate,\n            messageId,\n            feedback,\n            feedbackTypeFilters,\n            activeWorkspaceId,\n            page,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chat-messages/index.ts#L65-L101","documentation":"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.","triggerScenarios":"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.)","commonSituations":"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.","solutions":["Call GET /api/v1/chatmessage/<id> with the chatflow id (use the singular 'chatmessage' prefix).","Guard the id is a non-empty string before building the URL.","If integrating, double-check the exact mount prefix — it is /chatmessage, not /chat-messages."],"exampleFix":"// before (wrong prefix + empty id)\nawait fetch(`${BASE}/api/v1/chat-messages/`, { headers })\n\n// after (correct singular prefix, concrete id)\nif (!chatflowId) throw new Error('chatflow id required')\nawait fetch(`${BASE}/api/v1/chatmessage/${encodeURIComponent(chatflowId)}`, { headers })","handlingStrategy":"validation","validationCode":"function assertId(id: unknown): string {\n  if (typeof id !== 'string' || id.trim() === '') {\n    throw new Error('chatflow id is required')\n  }\n  return id\n}\nconst id = assertId(selectedChatflowId)\nawait fetch(`${BASE}/api/v1/chatmessage/${encodeURIComponent(id)}`, { headers }) // singular 'chatmessage'","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0","tryCatchPattern":null,"preventionTips":["Use the correct singular prefix: /api/v1/chatmessage, not /chat-messages.","Always include the chatflow id; never GET the collection root expecting a single resource's messages.","Centralize the chatmessage URL behind a helper that rejects empty ids and uses the singular prefix."],"tags":["validation","express","path-param","precondition-failed","flowise","chat-messages","gotcha"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}