FlowiseAI/Flowise · error · InternalFlowiseError

Error: chatflowsController.deleteScheduleTriggerLogs - works

Error message

Error: chatflowsController.deleteScheduleTriggerLogs - workspace not found!

What it means

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.

Source

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

        const status = Array.isArray(statusRaw) ? (statusRaw as any) : statusRaw ? (String(statusRaw) as any) : undefined
        const result = await scheduleService.getTriggerLogs(req.params.id, workspaceId, { page, limit, status })
        return res.json(result)
    } catch (error) {
        next(error)
    }
}

const deleteScheduleTriggerLogs = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (!req.params?.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                'Error: chatflowsController.deleteScheduleTriggerLogs - id not provided!'
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                'Error: chatflowsController.deleteScheduleTriggerLogs - workspace not found!'
            )
        }
        const logIds: unknown = req.body?.logIds
        if (!Array.isArray(logIds) || logIds.some((x) => typeof x !== 'string')) {
            throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, 'logIds must be a string[]')
        }
        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) {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Authenticate the request and ensure an active workspace is set.
  2. Re-prompt login on 401 before retrying the delete.
  3. Verify auth middleware is registered on the route.

Example fix

// before
fetch(url, { method: 'DELETE', body: JSON.stringify({ logIds }) })
// after
fetch(url, { method: 'DELETE', headers: { Authorization: `Bearer ${token}` }, body: JSON.stringify({ logIds }) })
Defensive patterns

Strategy: validation

Validate before calling

async function authedDelete(url: string, body: unknown) {
  if (!token) throw new Error('no auth token - cannot resolve active workspace')
  return fetch(url, { method: 'DELETE', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
}

Type guard

const hasActiveWorkspace = (u: unknown): u is { activeWorkspaceId: string } =>
  !!u && typeof (u as any).activeWorkspaceId === 'string'

Try / catch

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 }

Prevention

When it happens

Trigger: Unauthenticated request or a user without an activeWorkspaceId hitting the log-deletion endpoint.

Common situations: Session expired before a destructive action, API key without workspace scope, or middleware bypass.

Related errors


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