{"record":{"id":"cd4931ab8c2a24be","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-getschedulestatus-wor","errorCode":null,"errorMessage":"Error: chatflowsController.getScheduleStatus - workspace not found!","messagePattern":"Error: chatflowsController\\.getScheduleStatus - workspace not found!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":404,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":350,"sourceCode":"        }\n        await chatflowsService.clearWebhookSecret(req.params.id, workspaceId)\n        return res.sendStatus(StatusCodes.NO_CONTENT)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getScheduleStatus = 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.getScheduleStatus - id not provided!'\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(StatusCodes.NOT_FOUND, 'Error: chatflowsController.getScheduleStatus - workspace not found!')\n        }\n        const status = await scheduleService.getScheduleStatus(req.params.id, workspaceId)\n        return res.json({\n            enabled: status.record?.enabled ?? false,\n            canEnable: status.canEnable,\n            reason: status.reason,\n            record: status.record\n        })\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst getScheduleTriggerLogs = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.params?.id) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L332-L368","documentation":"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).","triggerScenarios":"Request arrives without req.user or with a user lacking activeWorkspaceId — unauthenticated call, expired session, or a user not yet assigned to a workspace.","commonSituations":"Session expired while the schedule UI was open, API key without workspace binding, or middleware ordering that bypasses auth for this route.","solutions":["Authenticate the request so req.user.activeWorkspaceId is set.","Confirm the user has an active workspace; create/assign one if missing.","Ensure the auth/workspace middleware runs before this handler."],"exampleFix":"// before\nconst res = await fetch(`/api/v1/chatflows/${id}/schedule/status`)\n// after\nconst res = await fetch(`/api/v1/chatflows/${id}/schedule/status`, {\n  headers: { Authorization: `Bearer ${token}` }\n})","handlingStrategy":"validation","validationCode":"async function authedFetch(url: string) {\n  if (!token) throw new Error('no auth token - cannot resolve active workspace')\n  return fetch(url, { headers: { Authorization: `Bearer ${token}` } })\n}","typeGuard":"const hasActiveWorkspace = (u: unknown): u is { activeWorkspaceId: string } =>\n  !!u && typeof (u as any).activeWorkspaceId === 'string'","tryCatchPattern":"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 }","preventionTips":["Authenticate schedule-status requests.","Ensure an active workspace is selected.","Verify auth middleware ordering."],"tags":["flowise","controller","validation","workspace","auth","not-found","scheduling","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}