{"record":{"id":"1e28a200755715eb","repo":"FlowiseAI/Flowise","slug":"error-chatflowscontroller-deletescheduletriggerlo-1e28a2","errorCode":null,"errorMessage":"Error: chatflowsController.deleteScheduleTriggerLogs - workspace not found!","messagePattern":"Error: chatflowsController\\.deleteScheduleTriggerLogs - workspace not found!","errorType":"exception","errorClass":"InternalFlowiseError","httpStatus":404,"severity":"error","filePath":"packages/server/src/controllers/chatflows/index.ts","lineNumber":400,"sourceCode":"        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) {\n            throw new InternalFlowiseError(\n                StatusCodes.PRECONDITION_FAILED,\n                'Error: chatflowsController.deleteScheduleTriggerLogs - 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.deleteScheduleTriggerLogs - workspace not found!'\n            )\n        }\n        const logIds: unknown = req.body?.logIds\n        if (!Array.isArray(logIds) || logIds.some((x) => typeof x !== 'string')) {\n            throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'logIds must be a string[]')\n        }\n        const result = await scheduleService.deleteTriggerLogs(req.params.id, workspaceId, logIds as string[])\n        return res.json(result)\n    } catch (error) {\n        next(error)\n    }\n}\n\nconst toggleScheduleEnabled = async (req: Request, res: Response, next: NextFunction) => {\n    try {\n        if (!req.params?.id) {","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/server/src/controllers/chatflows/index.ts#L382-L418","documentation":"Thrown by deleteScheduleTriggerLogs when req.user?.activeWorkspaceId is falsy. Deletion is workspace-scoped to prevent cross-tenant log removal. Returned as NOT_FOUND (404). Same guard pattern as the sibling schedule endpoints.","triggerScenarios":"Unauthenticated request or a user without an activeWorkspaceId hitting the log-deletion endpoint.","commonSituations":"Session expired before a destructive action, API key without workspace scope, or middleware bypass.","solutions":["Authenticate the request and ensure an active workspace is set.","Re-prompt login on 401 before retrying the delete.","Verify auth middleware is registered on the route."],"exampleFix":"// before\nfetch(url, { method: 'DELETE', body: JSON.stringify({ logIds }) })\n// after\nfetch(url, { method: 'DELETE', headers: { Authorization: `Bearer ${token}` }, body: JSON.stringify({ logIds }) })","handlingStrategy":"validation","validationCode":"async function authedDelete(url: string, body: unknown) {\n  if (!token) throw new Error('no auth token - cannot resolve active workspace')\n  return fetch(url, { method: 'DELETE', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify(body) })\n}","typeGuard":"const hasActiveWorkspace = (u: unknown): u is { activeWorkspaceId: string } =>\n  !!u && typeof (u as any).activeWorkspaceId === 'string'","tryCatchPattern":"try { await api.deleteTriggerLogs(id, logIds) } catch (e) { if (e.statusCode === 404 && /workspace/i.test(e.message)) { await reAuth(); await api.deleteTriggerLogs(id, logIds) } else throw e }","preventionTips":["Authenticate destructive requests.","Confirm an active workspace before deleting.","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"}