{"record":{"id":"3978eabe562a4113","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-setwebhooksecret-id-n","errorCode":null,"errorMessage":"Error: chatflowsController.setWebhookSecret - id not provided!","messagePattern":"Error: chatflowsController\\.setWebhookSecret - id not provided!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":412,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":305,"sourceCode":"        }\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)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst setWebhookSecret = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.params.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                `Error: chatflowsController.setWebhookSecret - id not provided!`\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(StatusCodes.UNAUTHORIZED, `Error: chatflowsController.setWebhookSecret - workspace not found!`)\n        }\n        const apiResponse = await chatflowsService.setWebhookSecret(req.params.id, workspaceId)\n        return res.json(apiResponse)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst clearWebhookSecret = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.params.id) {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L287-L323","documentation":"Thrown by setWebhookSecret when req.params.id is falsy. The endpoint generates/sets a webhook secret for a single chatflow identified by its id, so a missing id makes the target ambiguous. Returned as PRECONDITION_FAILED (412). Like the other id guards, it is a controller-level guard that short-circuits before calling chatflowsService.setWebhookSecret.","triggerScenarios":"A POST/PUT to the set-webhook-secret route whose path omits the chatflow id, or a route registration that does not declare :id so req.params.id is undefined.","commonSituations":"Client builds the URL with an undefined/null id variable, a copy-paste of a URL template with the id placeholder left in, or a router wiring bug where the handler is mounted on a path without :id.","solutions":["Provide a non-empty chatflow id in the request path.","Validate the id is a truthy string on the client before constructing the URL.","Confirm the Express route declares :id (e.g. router.post('/:id/webhook-secret', ...))."],"exampleFix":"// before\nawait fetch(`/api/v1/chatflows//webhook-secret`, { method: 'POST' })\n// after\nawait fetch(`/api/v1/chatflows/${encodeURIComponent(chatflowId)}/webhook-secret`, { method: 'POST' })","handlingStrategy":"validation","validationCode":"function setWebhookSecret(id: string) {\n  if (!id) throw new Error('chatflow id required before setting webhook secret')\n  return fetch(`/api/v1/chatflows/${encodeURIComponent(id)}/webhook-secret`, { method: 'POST' })\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0","tryCatchPattern":"try { await setWebhookSecret(id) } catch (e) { if (e.statusCode === 412) throw new Error('provide a chatflow id') }","preventionTips":["Disable webhook-secret actions until a chatflow is selected.","Validate id presence client-side before building the URL.","Confirm the route declares :id."],"tags":["flowise","controller","validation","precondition-failed","path-param","webhook","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}