bytebase/bytebase · error
failed to get schema list for catalog %s
Error message
failed to get schema list for catalog %s
What it means
SyncDBSchema fetches the list of schemas in the target catalog via d.getSchemaList(ctx). On failure it wraps the error with the catalog name (d.databaseName). The schema enumeration query against Trino's system JDBC tables failed, so database-level sync aborts.
Source
Thrown at backend/plugin/db/trino/sync.go:48
}
return &db.InstanceMetadata{
Version: version,
Databases: catalogMetadata,
Metadata: &storepb.Instance{},
}, nil
}
// SyncDBSchema syncs a single database schema.
func (d *Driver) SyncDBSchema(ctx context.Context) (*storepb.DatabaseSchemaMetadata, error) {
catalog := d.databaseName
dbMeta := &storepb.DatabaseSchemaMetadata{
Name: catalog,
}
schemaNames, err := d.getSchemaList(ctx)
if err != nil {
return nil, errors.Wrapf(err, "failed to get schema list for catalog %s", d.databaseName)
}
// Fetch all tables in all schemas in one query
allTables, err := d.fetchAllTablesForCatalog(ctx, schemaNames)
if err != nil {
return nil, errors.Wrapf(err, "failed to fetch tables for catalog %s", d.databaseName)
}
// Fetch all columns for all tables in one query
allColumns, err := d.fetchAllColumnsForCatalog(ctx)
if err != nil {
return nil, errors.Wrapf(err, "failed to fetch columns for catalog %s", d.databaseName)
}
// Organize the data into schemas
var schemas []*storepb.SchemaMetadata
for _, schemaName := range schemaNames {
tables := allTables[schemaName]View on GitHub (pinned to 1870550677)
Solutions
- Verify the catalog name in the connection config matches a catalog listed by SHOW CATALOGS
- Run SELECT * FROM system.jdbc.schemata AS the sync user to check access
- Fix connectivity/auth issues indicated by the wrapped error
- Re-run database sync after correcting the catalog configuration
Example fix
// before dbMeta, err := driver.SyncDBSchema(ctx, db) // catalog "prod1" doesn't exist // after // correct databaseName in instance config to "prod" dbMeta, err := driver.SyncDBSchema(ctx, db)
Defensive patterns
Strategy: validation
Validate before calling
catalogs, err := d.getCatalog(ctx)
if err != nil {
return fmt.Errorf("cannot enumerate catalogs: %w", err)
}
if !slices.Contains(catalogs, d.databaseName) {
return fmt.Errorf("catalog %q not found on coordinator", d.databaseName)
} Try / catch
schemaNames, err := d.getSchemaList(ctx)
if err != nil {
return nil, errors.Wrapf(err, "failed to get schema list for catalog %s", d.databaseName)
} Prevention
- Verify the catalog name exists via SHOW CATALOGS at config time
- Alert on catalog drift when a previously configured catalog disappears
- Keep the sync user's system.jdbc grants in infrastructure-as-code
When it happens
Trigger: Calling SyncDBSchema when the schema-list query (SELECT over system.jdbc.schemata) fails because of connectivity, missing catalog, or permission errors.
Common situations: Catalog name typo in the instance configuration, catalog was removed from the coordinator, or the sync user cannot read system.jdbc tables.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- failed to get database definition
- failed to get Trino version
- failed to get catalog list
- failed to fetch tables for catalog %s
- failed to fetch columns for catalog %s
AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06).
Data as JSON: /api/errors/4a52d96bec2b4f7d.
Report an issue: GitHub.