FlowiseAI/Flowise · error · Error
Database not available
Error message
Database not available
What it means
Thrown by CustomMcpServerTool.getTools when options.appDataSource or options.databaseEntities['CustomMcpServer'] is missing. This is an infrastructure precondition — the Flowise runtime must inject the TypeORM DataSource and the registered entity for managed MCP servers. Hitting it means getTools was called outside the normal flow-execution context (where options are populated) or the CustomMcpServer entity is not registered in this build.
Source
Thrown at packages/components/nodes/tools/MCP/CustomMcpServerTool/CustomMcpServerTool.ts:127
mcpActions = typeof _mcpActions === 'string' ? JSON.parse(_mcpActions) : _mcpActions
} catch (error) {
console.error('Error parsing mcp actions:', error)
}
}
return tools.filter((tool: any) => mcpActions.includes(tool.name))
}
async getTools(nodeData: INodeData, options: ICommonObject): Promise<Tool[]> {
const serverId = nodeData.inputs?.mcpServerId as string
if (!serverId) {
throw new Error('MCP Server is required')
}
const appDataSource = options.appDataSource as DataSource
const databaseEntities = options.databaseEntities as IDatabaseEntity
if (!appDataSource || !databaseEntities?.['CustomMcpServer']) {
throw new Error('Database not available')
}
const workspaceId =
(options.workspaceId as string | undefined) ??
((options.searchOptions as ICommonObject | undefined)?.workspaceId as string | undefined)
if (!workspaceId) {
throw new Error('Workspace context is required to load MCP server')
}
const serverRecord = await appDataSource.getRepository(databaseEntities['CustomMcpServer']).findOneBy({ id: serverId, workspaceId })
if (!serverRecord) {
throw new Error(`MCP server ${serverId} not found`)
}
if (serverRecord.status !== 'AUTHORIZED') {
throw new Error(`MCP server "${serverRecord.name}" is not authorized. Please authorize it in the Tools page first.`)
}
// Build headers from encrypted authConfig — only when authType explicitly requires themView on GitHub (pinned to abe4a8601a)
Solutions
- Ensure the tool is invoked through the Flowise runtime, which injects appDataSource and databaseEntities into options.
- If calling programmatically, populate options.appDataSource and options.databaseEntities.CustomMcpServer with the real TypeORM DataSource and entity.
- Confirm the CustomMcpServer entity is registered (DB migration ran); re-run migrations if missing.
- Rebuild/restart Flowise after an entity-name change.
Example fix
// before (in a test)
await tool.getTools(nodeData, {})
// after
await tool.getTools(nodeData, { appDataSource, databaseEntities: { CustomMcpServer: Entity }, workspaceId: 'ws1' }) Defensive patterns
Strategy: type-guard
Validate before calling
function assertRuntimeReady(options: ICommonObject) {
if (!options.appDataSource) throw new Error('appDataSource not injected — call via the Flowise runtime')
if (!options.databaseEntities?.['CustomMcpServer']) throw new Error('CustomMcpServer entity not registered — run migrations')
} Type guard
function hasDataSource(o: unknown): o is { appDataSource: DataSource; databaseEntities: IDatabaseEntity } {
return !!o && typeof (o as any).appDataSource?.getRepository === 'function' && !!(o as any).databaseEntities?.['CustomMcpServer']
} Prevention
- Invoke through the Flowise runtime which injects DataSource + entities.
- In tests, populate options.appDataSource and options.databaseEntities manually.
- Run DB migrations so the CustomMcpServer entity is registered.
- Rebuild after any entity-name change.
When it happens
Trigger: Invoking the tool from a test harness or script that constructs options manually without appDataSource/databaseEntities; running on a Flowise build where the CustomMcpServer migration/entity is disabled; a race where getTools runs before the DataSource is initialized.
Common situations: Unit tests that bypass Flowise DI; a stripped-down Flowise fork that omitted the MCP server entity; an upgrade where the entity name changed but the code wasn't rebuilt.
Related errors
- MCP server ${serverId} not found
- No postgres url provided
- Assistant ${selectedAssistantId} not found
- Error creating ${this.tableName} table
- Error retrieving ${this.tableName}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/45f6e9e455117e58.
Report an issue: GitHub.