FlowiseAI/Flowise · error · InternalFlowiseError
Error: chatflowsController.toggleScheduleEnabled - workspace
Error message
Error: chatflowsController.toggleScheduleEnabled - workspace not found!
What it means
Thrown by toggleScheduleEnabled when req.user?.activeWorkspaceId is falsy. Enabling/disabling a schedule mutates workspace-scoped state and triggers ScheduleBeat, so the workspace context is mandatory. Returned as NOT_FOUND (404).
Source
Thrown at packages/server/src/controllers/chatflows/index.ts:426
}
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)
}
}
export default {
checkIfChatflowIsValidForStreaming,
checkIfChatflowIsValidForUploads,
deleteChatflow,
getAllChatflows,View on GitHub (pinned to abe4a8601a)
Solutions
- Authenticate and ensure the caller has an active workspace.
- Handle 401/404 by re-authenticating before re-attempting the toggle.
- Verify auth middleware ordering on the route.
Example fix
// before
fetch(url, { method: 'POST', body: JSON.stringify({ enabled: true }) })
// after
fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${token}` }, body: JSON.stringify({ enabled: true }) }) Defensive patterns
Strategy: validation
Validate before calling
async function authedFetch(url: string, init: RequestInit) {
if (!token) throw new Error('no auth token - cannot resolve active workspace')
return fetch(url, { ...init, headers: { ...init.headers, Authorization: `Bearer ${token}` } })
} Type guard
const hasActiveWorkspace = (u: unknown): u is { activeWorkspaceId: string } =>
!!u && typeof (u as any).activeWorkspaceId === 'string' Try / catch
try { await api.toggleSchedule(id, enabled) } catch (e) { if (e.statusCode === 404 && /workspace/i.test(e.message)) { await reAuth(); await api.toggleSchedule(id, enabled) } else throw e } Prevention
- Authenticate schedule-toggle requests.
- Ensure an active workspace is set.
- Verify auth middleware on the route.
When it happens
Trigger: Unauthenticated request, expired session, or user without an activeWorkspaceId reaching the toggle endpoint.
Common situations: Session lapsed while the schedule toggle was interactive, API key lacking workspace binding, or auth middleware skipped on the route.
Related errors
- Error: chatflowsController.getScheduleStatus - workspace not
- Error: chatflowsController.getScheduleTriggerLogs - workspac
- Error: chatflowsController.deleteScheduleTriggerLogs - works
- Error: chatflowsController.checkIfChatflowHasChanged - activ
- Error: chatflowsController.setWebhookSecret - workspace not
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/98b25733898bc9eb.
Report an issue: GitHub.