FlowiseAI/Flowise · error · InternalFlowiseError

Error: chatflowsController.setWebhookSecret - id not provide

Error message

Error: chatflowsController.setWebhookSecret - id not provided!

What it means

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.

Source

Thrown at packages/server/src/controllers/chatflows/index.ts:305

        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                'Error: chatflowsController.checkIfChatflowHasChanged - active workspace ID not found!'
            )
        }
        const apiResponse = await chatflowsService.checkIfChatflowHasChanged(req.params.id, req.params.lastUpdatedDateTime, workspaceId)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

const setWebhookSecret = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: chatflowsController.setWebhookSecret - id not provided!`
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(StatusCodes.UNAUTHORIZED, `Error: chatflowsController.setWebhookSecret - workspace not found!`)
        }
        const apiResponse = await chatflowsService.setWebhookSecret(req.params.id, workspaceId)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

const clearWebhookSecret = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params.id) {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Provide a non-empty chatflow id in the request path.
  2. Validate the id is a truthy string on the client before constructing the URL.
  3. Confirm the Express route declares :id (e.g. router.post('/:id/webhook-secret', ...)).

Example fix

// before
await fetch(`/api/v1/chatflows//webhook-secret`, { method: 'POST' })
// after
await fetch(`/api/v1/chatflows/${encodeURIComponent(chatflowId)}/webhook-secret`, { method: 'POST' })
Defensive patterns

Strategy: validation

Validate before calling

function setWebhookSecret(id: string) {
  if (!id) throw new Error('chatflow id required before setting webhook secret')
  return fetch(`/api/v1/chatflows/${encodeURIComponent(id)}/webhook-secret`, { method: 'POST' })
}

Type guard

const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0

Try / catch

try { await setWebhookSecret(id) } catch (e) { if (e.statusCode === 412) throw new Error('provide a chatflow id') }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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