FlowiseAI/Flowise · error · InternalFlowiseError
Error: chatflowsController.deleteChatflow - workspace ${work
Error message
Error: chatflowsController.deleteChatflow - workspace ${workspaceId} not found! What it means
Thrown by deleteChatflow when req.user?.activeWorkspaceId is absent (after org check passed). Returns 404 NOT_FOUND — again misleading, as the user context is incomplete rather than a record missing. Indicates the session has an org but no workspace selected/assigned.
Source
Thrown at packages/server/src/controllers/chatflows/index.ts:64
next(error)
}
}
const deleteChatflow = async (req: Request, res: Response, next: NextFunction) => {
try {
if (typeof req.params === 'undefined' || !req.params.id) {
throw new InternalFlowiseError(StatusCodes.PRECONDITION_FAILED, `Error: chatflowsController.deleteChatflow - id not provided!`)
}
const orgId = req.user?.activeOrganizationId
if (!orgId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: chatflowsController.deleteChatflow - organization ${orgId} not found!`
)
}
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: chatflowsController.deleteChatflow - workspace ${workspaceId} not found!`
)
}
const userPermittedTypes: EnumChatflowType[] = []
const permissions = req.user!.permissions
if (req.user?.isOrganizationAdmin) {
userPermittedTypes.push(EnumChatflowType.CHATFLOW)
userPermittedTypes.push(EnumChatflowType.AGENTFLOW)
userPermittedTypes.push(EnumChatflowType.MULTIAGENT)
userPermittedTypes.push(EnumChatflowType.ASSISTANT)
} else {
if (permissions.includes(`chatflows:delete`)) userPermittedTypes.push(EnumChatflowType.CHATFLOW)
if (permissions.includes(`agentflows:delete`)) userPermittedTypes.push(EnumChatflowType.AGENTFLOW)
if (permissions.includes(`agentflows:delete`)) userPermittedTypes.push(EnumChatflowType.MULTIAGENT)
if (permissions.includes(`assistants:delete`)) userPermittedTypes.push(EnumChatflowType.ASSISTANT)
if (userPermittedTypes.length === 0)
throw new InternalFlowiseError(StatusCodes.FORBIDDEN, `You do not have permission to delete any chatflow types`)View on GitHub (pinned to abe4a8601a)
Solutions
- Confirm the user has a workspace membership row (workspace_user table).
- Run the workspace selection/switch flow so the active workspace claim is set.
- Check auth middleware injects activeWorkspaceId on this route.
- Decode JWT and verify the workspace claim exists.
Example fix
// before: logged in but no workspace selected
// after: select a workspace to populate the claim
await api.post('/workspaces/select', { workspaceId })
await api.delete(`/api/v1/chatflows/${id}`) Defensive patterns
Strategy: validation
Validate before calling
function hasWorkspaceClaim(user): boolean {
return Boolean(user && (user as any).activeWorkspaceId)
}
if (!hasWorkspaceClaim(currentUser)) {
// run workspace selection before delete
} Type guard
function hasWorkspaceContext(u: unknown): u is { activeWorkspaceId: string } {
return typeof u === 'object' && u !== null
&& typeof (u as any).activeWorkspaceId === 'string' && (u as any).activeWorkspaceId.length > 0
} Prevention
- Run the workspace selection step in the login flow.
- Ensure every user has a workspace_user row at provisioning.
- Verify the workspace-injecting middleware is on the delete route.
- Decode the JWT to confirm the workspace claim.
When it happens
Trigger: Authenticated DELETE with a token containing activeOrganizationId but no activeWorkspaceId. Happens when a user is in an org but hasn't selected or been assigned a workspace.
Common situations: Org admin created the user but no workspace was assigned; workspace_user row missing; client skipped the workspace-selection step after login; token minted before workspace feature shipped.
Related errors
- Error: chatMessagesController.removeAllChatMessages - worksp
- Error: chatflowsController.getChatflowById - workspace ${wor
- Error: chatflowsController.saveChatflow - workspace ${worksp
- Error: chatflowsController.deleteChatflow - organization ${o
- Error: chatflowsController.saveChatflow - organization ${org
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/e7ed0d4a576c7ce9.
Report an issue: GitHub.