{"record":{"id":"f37be49fb9b68541","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-getscheduletriggerlogs-f37be4","errorCode":null,"errorMessage":"Error: chatflowsController.getScheduleTriggerLogs - workspace not found!","messagePattern":"Error: chatflowsController\\.getScheduleTriggerLogs - workspace not found!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":404,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":374,"sourceCode":"            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,\n                'Error: chatflowsController.getScheduleTriggerLogs - id not provided!'\n            )\n        }\n        const workspaceId = req.user?.activeWorkspaceId\n        if (!workspaceId) {\n            throw new InternalFlowiseError(\n                StatusCodes.NOT_FOUND,\n                'Error: chatflowsController.getScheduleTriggerLogs - workspace not found!'\n            )\n        }\n        const page = req.query.page ? parseInt(String(req.query.page), 10) : undefined\n        const limit = req.query.limit ? parseInt(String(req.query.limit), 10) : undefined\n        const statusRaw = req.query.status\n        const status = Array.isArray(statusRaw) ? (statusRaw as any) : statusRaw ? (String(statusRaw) as any) : undefined\n        const result = await scheduleService.getTriggerLogs(req.params.id, workspaceId, { page, limit, status })\n        return res.json(result)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst deleteScheduleTriggerLogs = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.params?.id) {","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L356-L392","documentation":"Thrown by getScheduleTriggerLogs when req.user?.activeWorkspaceId is falsy. Logs are scoped to a workspace for tenant isolation. Returned as NOT_FOUND (404). Same root-cause family as the other workspace guards.","triggerScenarios":"Unauthenticated request, expired token, or authenticated user with no activeWorkspaceId reaching the logs endpoint.","commonSituations":"Long-opened admin page whose session expired before the user clicked 'View logs', API key misconfiguration, or test harness without req.user.","solutions":["Send a valid authenticated request.","Ensure the user has an active workspace.","Re-auth on 401/404 workspace errors before retrying."],"exampleFix":"// before\nfetch(`/api/v1/chatflows/${id}/schedule/logs`)\n// after\nfetch(`/api/v1/chatflows/${id}/schedule/logs`, { headers: { Authorization: `Bearer ${token}` } })","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.getTriggerLogs(id) } catch (e) { if (e.statusCode === 404 && /workspace/i.test(e.message)) { await reAuth(); await api.getTriggerLogs(id) } else throw e }","preventionTips":["Authenticate log-viewing requests.","Re-auth on session expiry.","Verify auth middleware on the route."],"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-12T18:17:37.767Z"}