FlowiseAI/Flowise · error · InternalFlowiseError

Error: chatflowsController.getScheduleStatus - workspace…

Error message

Error: chatflowsController.getScheduleStatus - workspace not found!

What it means

Thrown by getScheduleStatus when req.user?.activeWorkspaceId is falsy. Schedule records are workspace-scoped, so the lookup needs the caller's workspace. Returned as NOT_FOUND (404), consistent with most other workspace guards in this file (contrast with the webhook ones that use 401).

Solutions

  1. Authenticate the request so req.user.activeWorkspaceId is set.
  2. Confirm the user has an active workspace; create/assign one if missing.
  3. Ensure the auth/workspace middleware runs before this handler.

Example fix

// before
const res = await fetch(`/api/v1/chatflows/${id}/schedule/status`)
// after
const res = await fetch(`/api/v1/chatflows/${id}/schedule/status`, {
  headers: { Authorization: `Bearer ${token}` }
})
Defensive patterns

Strategy: validation

Validate before calling

async function authedFetch(url: string) {
  if (!token) throw new Error('no auth token - cannot resolve active workspace')
  return fetch(url, { 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.getScheduleStatus(id) } catch (e) { if (e.statusCode === 404 && /workspace/i.test(e.message)) { await reAuth(); await api.getScheduleStatus(id) } else throw e }

Prevention

When it happens

Trigger: Request arrives without req.user or with a user lacking activeWorkspaceId — unauthenticated call, expired session, or a user not yet assigned to a workspace.

Common situations: Session expired while the schedule UI was open, API key without workspace binding, or middleware ordering that bypasses auth for this route.

Related errors


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

Appendix: source

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

        }
        await chatflowsService.clearWebhookSecret(req.params.id, workspaceId)
        return res.sendStatus(StatusCodes.NO_CONTENT)
    } catch (error) {
        next(error)
    }
}

const getScheduleStatus = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params?.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                'Error: chatflowsController.getScheduleStatus - id not provided!'
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(StatusCodes.NOT_FOUND, 'Error: chatflowsController.getScheduleStatus - workspace not found!')
        }
        const status = await scheduleService.getScheduleStatus(req.params.id, workspaceId)
        return res.json({
            enabled: status.record?.enabled ?? false,
            canEnable: status.canEnable,
            reason: status.reason,
            record: status.record
        })
    } catch (error) {
        next(error)
    }
}

const getScheduleTriggerLogs = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params?.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,

View on GitHub (pinned to abe4a8601a)