FlowiseAI/Flowise · error · InternalFlowiseError
"enabled" must be a boolean
Error message
"enabled" must be a boolean
What it means
Thrown by toggleScheduleEnabled when req.body.enabled is not strictly a boolean. Flowise requires the literal true/false to decide whether to upsert or delete the schedule via ScheduleBeat. Returned as BAD_REQUEST (400). Truthy/falsy values like 1/0 or 'true' are rejected because typeof !== 'boolean'.
Source
Thrown at packages/server/src/controllers/chatflows/index.ts:430
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)
}
}
export default {
checkIfChatflowIsValidForStreaming,
checkIfChatflowIsValidForUploads,
deleteChatflow,
getAllChatflows,
getChatflowByApiKey,
getChatflowById,
saveChatflow,
updateChatflow,View on GitHub (pinned to abe4a8601a)
Solutions
- Send { "enabled": true } (literal boolean) with Content-Type: application/json.
- Coerce on the client: const enabled = Boolean(value) before sending.
- Ensure express.json() parses the body; without it req.body is undefined and enabled is undefined.
Example fix
// before
fetch(url, { method: 'POST', body: JSON.stringify({ enabled: checkbox.checked ? 1 : 0 }) })
// after
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ enabled: checkbox.checked === true })
}) Defensive patterns
Strategy: type-guard
Validate before calling
function toToggleBody(value: unknown): { enabled: boolean } {
return { enabled: value === true || value === 'true' ? true : false }
} Type guard
const isBoolean = (v: unknown): v is boolean => typeof v === 'boolean'
Try / catch
try { await api.toggleSchedule(id, enabled) } catch (e) { if (e.statusCode === 400 && /enabled/.test(e.message)) { await api.toggleSchedule(id, Boolean(enabled)) } else throw e } Prevention
- Always set Content-Type: application/json.
- Coerce the control value with Boolean() before sending.
- Confirm express.json() is mounted.
When it happens
Trigger: The client sends enabled as a number (1/0), a string ('true'), undefined, or omits it. Sending enabled inside a nested object instead of the top-level body also fails.
Common situations: Form serializing a checkbox to 'on' or a number, a JSON body sent as form-urlencoded so booleans arrive as strings, or a payload built from a tri-state control that yields undefined.
Related errors
- logIds must be a string[]
- Error: chatflowsController.getScheduleStatus - id not provid
- Error: chatflowsController.getScheduleStatus - workspace not
- Error: chatflowsController.getScheduleTriggerLogs - id not p
- Error: chatflowsController.getScheduleTriggerLogs - workspac
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/5b2c697967c00ab3.
Report an issue: GitHub.