FlowiseAI/Flowise · error · InternalFlowiseError

Error: chatflowsController.toggleScheduleEnabled - id not pr

Error message

Error: chatflowsController.toggleScheduleEnabled - id not provided!

What it means

Thrown by toggleScheduleEnabled when req.params?.id is falsy. The endpoint turns a chatflow's scheduled trigger on/off, so it must target a specific chatflow. Returned as PRECONDITION_FAILED (412). After validation it reads req.body.enabled and notifies ScheduleBeat.

Source

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

                StatusCodes.NOT_FOUND,
                'Error: chatflowsController.deleteScheduleTriggerLogs - workspace not found!'
            )
        }
        const logIds: unknown = req.body?.logIds
        if (!Array.isArray(logIds) || logIds.some((x) => typeof x !== 'string')) {
            throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'logIds must be a string[]')
        }
        const result = await scheduleService.deleteTriggerLogs(req.params.id, workspaceId, logIds as string[])
        return res.json(result)
    } catch (error) {
        next(error)
    }
}

const toggleScheduleEnabled = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params?.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                'Error: chatflowsController.toggleScheduleEnabled - id not provided!'
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(StatusCodes.NOT_FOUND, 'Error: chatflowsController.toggleScheduleEnabled - workspace not found!')
        }
        const { enabled } = req.body
        if (typeof enabled !== 'boolean') {
            throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, '"enabled" must be a boolean')
        }
        const record = await scheduleService.toggleScheduleEnabled(req.params.id, workspaceId, enabled)
        await ScheduleBeat.getInstance().onScheduleChanged(record.id, enabled ? 'upsert' : 'delete')
        return res.json(record)
    } catch (error) {
        next(error)
    }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Provide the chatflow id in the path.
  2. Disable the toggle control on the client until a chatflow is selected.
  3. Confirm the route declares :id.

Example fix

// before
fetch(`/api/v1/chatflows//schedule/toggle`, { method: 'POST', body: JSON.stringify({ enabled: true }) })
// after
fetch(`/api/v1/chatflows/${encodeURIComponent(id)}/schedule/toggle`, { method: 'POST', body: JSON.stringify({ enabled: true }) })
Defensive patterns

Strategy: validation

Validate before calling

function toggleSchedule(id: string, enabled: boolean) {
  if (!id) throw new Error('chatflow id required to toggle schedule')
  return fetch(`/api/v1/chatflows/${encodeURIComponent(id)}/schedule/toggle`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ enabled }) })
}

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: POST/PUT to the toggle route with the :id segment missing.

Common situations: Toggle button clicked before a chatflow is loaded, URL built from an undefined id, or route not declaring :id.

Related errors


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