FlowiseAI/Flowise · error · InternalFlowiseError

Error: assistantsController.getAssistantById - workspace ${w

Error message

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

What it means

Thrown by getAssistantById with HTTP 404 after the id guard passes, when req.user?.activeWorkspaceId is falsy. The lookup getAssistantById(id, workspaceId) is workspace-scoped, so a missing workspace blocks it.

Source

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

        }
        const apiResponse = await assistantsService.getAllAssistants(workspaceId, type)
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

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

const updateAssistant = async (req: Request, res: Response, next: NextFunction) => {
    try {
        if (typeof req.params === 'undefined' || !req.params.id) {
            throw new InternalFlowiseError(
                StatusCodes.PRECONDITION_FAILED,
                `Error: assistantsController.updateAssistant - id not provided!`
            )

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Select/switch into a workspace, then retry.
  2. Verify auth middleware populates activeWorkspaceId and the user's 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 {
  return await getAssistantById(id)
} catch (err) {
  if (err?.statusCode === 404 && /workspace .* not found/i.test(err.message)) {
    await selectWorkspace()
    return getAssistantById(id)
  }
  throw err
}

Prevention

When it happens

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

Common situations: Direct-link/deep-link to an assistant before workspace selection; session expired/reset; no workspace membership.

Related errors


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