OtterMind/Chat2DB · error · BusinessException
datasource.not.found
datasource.not.found
Error message
datasource.not.found
What it means
Thrown by buildConnectInfo() when workspaceDataSourceService.queryDisplayDataSourceById(dataSourceId, true) returns null — the requested data source does not exist or is not visible to the current user. There is no i18n entry for 'datasource.not.found', so the raw key is shown.
Solutions
- Verify the dataSourceId exists and is visible to the user before attempting to connect.
- If deleted, clear the stale reference on the client and force a datasource-list refresh.
- Add an i18n entry for 'datasource.not.found' so users see a localized 'Data source not found' message.
Defensive patterns
Strategy: validation
Validate before calling
// Before connecting
WorkspaceDataSource ds = workspaceDataSourceService.queryDisplayDataSourceById(dataSourceId, true);
if (ds == null) {
return Result.fail("datasource.not.found"); // or a localized message
}
dbConnectionContextService.connect(param); Prevention
- Validate the datasource ID exists and is visible to the user before connecting.
- Refresh the datasource list on the client when an ID becomes stale after deletion.
- Add an i18n entry for 'datasource.not.found' so users see a localized message.
When it happens
Trigger: DbConnectionContextServiceImpl.connect(param) is called with a dataSourceId that has no matching row in the workspace data source store (deleted, wrong ID, permission/visibility filtered out).
Common situations: Stale datasource ID cached on the frontend after the datasource was deleted, a mistyped/forbidden ID, or a multi-tenant visibility filter hiding the row.
Related errors
- connection error
- connection error
- datasource_connection_failed
- datasource_not_found
- datasource.not.found
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/f664287411dda0f3.
Report an issue: GitHub.
Appendix: source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbConnectionContextServiceImpl.java:195
List<ai.chat2db.community.domain.api.model.metadata.Table> tables;
if (ObjectTypeEnum.VIEW.name().equalsIgnoreCase(objectType)) {
tables = metaData.views(Chat2DBContext.getConnection(),
new ViewMetadataRequest(databaseName, schemaName, objectName));
} else {
tables = metaData.tables(Chat2DBContext.getConnection(),
new TablesRequest(databaseName, schemaName, objectName));
}
if (tables == null) {
return Collections.emptyList();
}
return tables.stream().filter(Objects::nonNull).toList();
}
private ConnectInfo buildConnectInfo(DbConnectionContextRequest param) {
WorkspaceDataSource dataSource = workspaceDataSourceService.queryDisplayDataSourceById(param.getDataSourceId(), true);
if (dataSource == null) {
log.info("query datasource failed:{}", param.getDataSourceId());
throw new BusinessException("datasource.not.found");
}
return connectionContextConverter.datasource2connectInfo(param, dataSource, dataSource.getUrl());
}
private ConnectInfo buildMcpConnectInfo(McpConnectionContextRequest param) {
return connectionContextConverter.mcpParam2connectInfo(param, connectionContextConverter.buildMcpDataSourceId(param));
}
}
View on GitHub (pinned to 5ee1e990e7)