FlowiseAI/Flowise · error · InternalFlowiseError
Error: assistantsController.createAssistant - workspace ${wo
Error message
Error: assistantsController.createAssistant - workspace ${workspaceId} not found! What it means
Thrown by createAssistant with HTTP 404 after body and organization checks pass, when workspaceId = req.user?.activeWorkspaceId is falsy. The interpolated message reads 'workspace undefined not found'. Even with an org selected, an active workspace must also be present because assistants are scoped per workspace.
Source
Thrown at packages/server/src/controllers/assistants/index.ts:27
const createAssistant = async (req: Request, res: Response, next: NextFunction) => {
try {
if (!req.body) {
throw new InternalFlowiseError(
StatusCodes.PRECONDITION_FAILED,
`Error: assistantsController.createAssistant - body not provided!`
)
}
const body = req.body
const orgId = req.user?.activeOrganizationId
if (!orgId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: assistantsController.createAssistant - organization ${orgId} not found!`
)
}
const workspaceId = req.user?.activeWorkspaceId
if (!workspaceId) {
throw new InternalFlowiseError(
StatusCodes.NOT_FOUND,
`Error: assistantsController.createAssistant - workspace ${workspaceId} not found!`
)
}
const subscriptionId = req.user?.activeOrganizationSubscriptionId || ''
const existingAssistantCount = await assistantsService.getAssistantsCountByOrganization(body.type, orgId)
const newAssistantCount = 1
await checkUsageLimit('flows', subscriptionId, getRunningExpressApp().usageCacheManager, existingAssistantCount + newAssistantCount)
const apiResponse = await assistantsService.createAssistant(body, orgId, workspaceId)
return res.json(apiResponse)
} catch (error) {
next(error)
}
}
View on GitHub (pinned to abe4a8601a)
Solutions
- Select/switch into a workspace so the session carries activeWorkspaceId, then retry the POST.
- Verify the user has a workspace membership; create one if missing.
- Confirm auth middleware sets activeWorkspaceId on req.user.
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 createAssistant(payload)
} catch (err) {
if (err?.statusCode === 404 && /workspace .* not found/i.test(err.message)) {
await selectWorkspace()
return createAssistant(payload)
}
throw err
} Prevention
- Require an active workspace (not just an org) before creating an assistant.
- Handle workspace 404s by re-running workspace selection and retrying once.
- Validate workspace membership exists for the user.
When it happens
Trigger: POST /api/v1/assistants with a valid body and a valid activeOrganizationId, but no activeWorkspaceId in the session — the user selected an org but not a workspace, or has no workspace membership.
Common situations: Workspace creation/selection step skipped after org selection; workspace membership deleted; session created before workspace onboarding completed.
Related errors
- Error: assistantsController.deleteAssistant - workspace ${wo
- Error: assistantsController.getAllAssistants - workspace ${w
- Error: assistantsController.getAssistantById - workspace ${w
- Error: assistantsController.updateAssistant - workspace ${wo
- Error: assistantsController.getDocumentStores - workspace ${
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/1a1f31c65122efce.
Report an issue: GitHub.