FlowiseAI/Flowise · error · InternalFlowiseError

Error: assistantsController.getDocumentStores - workspace ${

Error message

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

What it means

Thrown by getDocumentStores with HTTP 404 when req.user?.activeWorkspaceId is falsy. Mounted at GET /api/v1/assistants/components/docstores (routes/assistants/index.ts:21). Document stores are workspace-scoped, so an active workspace is required to list them. This handler has no id/body guard — the only precondition is the workspace.

Source

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

    } catch (error) {
        next(error)
    }
}

const getChatModels = async (req: Request, res: Response, next: NextFunction) => {
    try {
        const apiResponse = await assistantsService.getChatModels()
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }
}

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

const getTools = async (req: Request, res: Response, next: NextFunction) => {
    try {
        const apiResponse = await assistantsService.getTools()
        return res.json(apiResponse)
    } catch (error) {
        next(error)
    }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Ensure a workspace is selected (activeWorkspaceId in session) before loading document stores.
  2. Verify auth middleware and 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 getDocumentStores()
} catch (err) {
  if (err?.statusCode === 404 && /workspace .* not found/i.test(err.message)) {
    await selectWorkspace()
    return getDocumentStores()
  }
  throw err
}

Prevention

When it happens

Trigger: GET /api/v1/assistants/components/docstores from a session with no activeWorkspaceId.

Common situations: Assistant builder UI loading its document-store picker before workspace selection completed; session reset; user with no workspace membership.

Related errors


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