{"record":{"id":"0d34f3f54aa4be3f","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-checkifchatflowhaschang","errorCode":null,"errorMessage":"Error: chatflowsController.checkIfChatflowHasChanged - id not provided!","messagePattern":"Error: chatflowsController\\.checkIfChatflowHasChanged - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":277,"sourceCode":"const getSinglePublicChatbotConfig = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatflowsController.getSinglePublicChatbotConfig - id not provided!`\n            )\n        }\n        const apiResponse = await chatflowsService.getSinglePublicChatbotConfig(req.params.id)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst checkIfChatflowHasChanged = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (typeof req.params === 'undefined' || !req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatflowsController.checkIfChatflowHasChanged - id not provided!`\n            )\n        }\n        if (!req.params.lastUpdatedDateTime) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatflowsController.checkIfChatflowHasChanged - lastUpdatedDateTime not provided!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                'Error: chatflowsController.checkIfChatflowHasChanged - active workspace ID not found!'\n            )\n        }\n        const apiResponse = await chatflowsService.checkIfChatflowHasChanged(req.params.id, req.params.lastUpdatedDateTime, workspaceId)","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L259-L295","documentation":"Thrown by checkIfChatflowHasChanged when req.params.id is missing. PRECONDITION_FAILED (412) — the first of two guards; the handler also separately validates lastUpdatedDateTime immediately after. Used by clients to poll whether a chatflow was updated since a timestamp.","triggerScenarios":"Calling the has-changed polling endpoint without an id segment; client sent only lastUpdatedDateTime in the body/query but no id in the path.","commonSituations":"Polling loop started before an id was known; SDK path change; URL template using an undefined id.","solutions":["Ensure the request URL has a non-empty id segment.","Guard the client call against an undefined id.","Remember this endpoint also requires lastUpdatedDateTime — provide both."],"exampleFix":"// before\nawait api.get(`/api/v1/chatflows//has-changed?lastUpdatedDateTime=${ts}`)\n// after\nif (!id) throw new Error('id required')\nawait api.get(`/api/v1/chatflows/${id}/has-changed?lastUpdatedDateTime=${ts}`)","handlingStrategy":"validation","validationCode":"function validHasChangedParams(id: unknown, ts: unknown): boolean {\n  return typeof id === 'string' && id.length > 0 && typeof ts === 'string' && ts.length > 0\n}\nif (!validHasChangedParams(id, lastUpdatedDateTime)) {\n  throw new Error('id and lastUpdatedDateTime required for has-changed poll')\n}","typeGuard":"function isHasChangedParams(p: unknown): p is { id: string; lastUpdatedDateTime: string } {\n  return typeof p === 'object' && p !== null\n    && typeof (p as any).id === 'string' && (p as any).id.length > 0\n    && typeof (p as any).lastUpdatedDateTime === 'string' && (p as any).lastUpdatedDateTime.length > 0\n}","tryCatchPattern":null,"preventionTips":["Pass both id and lastUpdatedDateTime on every has-changed poll.","Start the polling loop only after the chatflow id is known.","Pin the SDK/server version so param names stay stable."],"tags":["flowise","express","params-validation","precondition","polling","controller"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}