FlowiseAI/Flowise · error · InternalFlowiseError

Error: assistantsController.deleteAssistant - workspace ${wo

Error message

Error: assistantsController.deleteAssistant - workspace ${workspaceId} not found!

What it means

Thrown by deleteAssistant with HTTP 404 after the id guard passes, when req.user?.activeWorkspaceId is falsy. The service call deleteAssistant(id, isDeleteBoth, workspaceId) needs a workspace to scope the delete, so a missing workspace blocks it.

Source

Thrown at packages/server/src/controllers/assistants/index.ts:56

        const apiResponse = await assistantsService.createAssistant(body, orgId, workspaceId)

        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

const deleteAssistant = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (typeof req.params === 'undefined' || !req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: assistantsController.deleteAssistant - id not provided!`
            )
        }
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,
                `Error: assistantsController.deleteAssistant - workspace ${workspaceId} not found!`
            )
        }
        const apiResponse = await assistantsService.deleteAssistant(req.params.id, req.query.isDeleteBoth, workspaceId)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

const getAllAssistants = async (req: Request, res: Response, next: NextFunction) => {
    try {
        const type = req.query.type as AssistantType
        const workspaceId = req.user?.activeWorkspaceId
        if (!workspaceId) {
            throw new InternalFlowiseError(
                StatusCodes.NOT_FOUND,

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Select/switch into a workspace so activeWorkspaceId is in the session, then retry.
  2. Verify auth middleware populates activeWorkspaceId and that the user has a workspace membership.
Defensive patterns

Strategy: try-catch

Type guard

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

Try / catch

try {
  await deleteAssistant(id)
} catch (err) {
  if (err?.statusCode === 404 && /workspace .* not found/i.test(err.message)) {
    await selectWorkspace()
    return deleteAssistant(id)
  }
  throw err
}

Prevention

When it happens

Trigger: Authenticated DELETE /api/v1/assistants/<id> from a session with no activeWorkspaceId.

Common situations: User authenticated but workspace not selected/membership missing; session/JWT missing the workspace claim.

Related errors


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