{"record":{"id":"5b2c697967c00ab3","repo":"FlowiseAI/Flowise","slug":"enabled-must-be-a-boolean","errorCode":null,"errorMessage":"\"enabled\" must be a boolean","messagePattern":"\"enabled\" must be a boolean","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":400,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":430,"sourceCode":"        next(error)\n    }\n}\n\nconst toggleScheduleEnabled = 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.toggleScheduleEnabled - id not provided!'\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(StatusCodes.NOT_FOUND, 'Error: chatflowsController.toggleScheduleEnabled - workspace not found!')\n        }\n        const { enabled } = req.body\n        if (typeof enabled !== 'boolean') {\n            throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, '\"enabled\" must be a boolean')\n        }\n        const record = await scheduleService.toggleScheduleEnabled(req.params.id, workspaceId, enabled)\n        await ScheduleBeat.getInstance().onScheduleChanged(record.id, enabled ? 'upsert' : 'delete')\n        return res.json(record)\n    } catch (error) {\n        next(error)\n    }\n}\n\nexport default {\n    checkIfChatflowIsValidForStreaming,\n    checkIfChatflowIsValidForUploads,\n    deleteChatflow,\n    getAllChatflows,\n    getChatflowByApiKey,\n    getChatflowById,\n    saveChatflow,\n    updateChatflow,","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L412-L448","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfetch(url, { method: 'POST', body: JSON.stringify({ enabled: checkbox.checked ? 1 : 0 }) })\n// after\nfetch(url, {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ enabled: checkbox.checked === true })\n})","handlingStrategy":"type-guard","validationCode":"function toToggleBody(value: unknown): { enabled: boolean } {\n  return { enabled: value === true || value === 'true' ? true : false }\n}","typeGuard":"const isBoolean = (v: unknown): v is boolean => typeof v === 'boolean'","tryCatchPattern":"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 }","preventionTips":["Always set Content-Type: application/json.","Coerce the control value with Boolean() before sending.","Confirm express.json() is mounted."],"tags":["flowise","controller","validation","bad-request","body-shape","scheduling","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}