apache/seatunnel · warning

Failed to get table schema from catalog, will try to infer…

Error message

Failed to get table schema from catalog, will try to infer schema from query

What it means

In DatabendSourceFactory.createSource(), if the Databend catalog cannot return the CatalogTable for the configured database/table, the exception is caught, this warning is logged, and the factory falls back to building a CatalogTable with an empty TableSchema, letting the reader infer schema from the query results at runtime. The job still starts but with weaker typing until inference completes.

Solutions

  1. Verify the table and database names in the source options exist in Databend
  2. Check URL, username and password by connecting manually (e.g. via mysql client / Bendsql)
  3. Grant the user metadata access on the target database
  4. Review the attached exception stack trace for the root cause; don't rely on inference if you need exact column types

Example fix

// before
} catch (Exception e) {
    log.warn("Failed to get table schema from catalog, will try to infer schema from query", e);
    TableSchema.Builder builder = TableSchema.builder();
// after
} catch (Exception e) {
    log.warn("Failed to get table schema from catalog, will try to infer schema from query", e);
    if (failOnMissingSchema) {
        throw new DatabendConnectorException(DatabendConnectorErrorCode.SCHEMA_NOT_FOUND, e);
    }
    TableSchema.Builder builder = TableSchema.builder();
Defensive patterns

Strategy: fallback

Validate before calling

// validate table existence before job submission
try (Connection c = DriverManager.getConnection(url, user, pass);
     Statement s = c.createStatement()) {
    s.executeQuery("SELECT 1 FROM " + database + "." + table + " LIMIT 0");
}

Type guard

boolean tableAccessible(String db, String tbl) {
    try (Connection c = DriverManager.getConnection(url, user, pass);
         Statement s = c.createStatement()) {
        s.execute("USE " + db);
        s.executeQuery("SELECT 1 FROM " + tbl + " LIMIT 0");
        return true;
    } catch (SQLException e) { return false; }
}

Try / catch

try {
    Source source = factory.createSource(context);
} catch (Exception e) {
    log.error("Source creation failed even after schema-inference fallback", e);
    throw e;
}

Prevention

When it happens

Trigger: catalog.getTable(tablePath) throws: table doesn't exist, wrong database/table name in options, JDBC connection failure, or insufficient privileges to read metadata.

Common situations: Typo in table or database config; table created later by the pipeline (auto-create); Databend unreachable (wrong URL/port); user lacking metadata permissions.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/d4d625d69164c174. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/source/DatabendSourceFactory.java:101

            String password = options.get(DatabendOptions.PASSWORD);
            Integer fetchSize = options.get(DatabendOptions.FETCH_SIZE);
            String sql = buildSqlStatement(options);

            String catalogName = "default";
            String database = options.getOptional(DATABASE).orElse("default");
            String table = options.getOptional(DatabendOptions.TABLE).orElse("default");

            // use catalog to get table schema
            DatabendCatalog catalog = new DatabendCatalog(options, catalogName);
            try {
                catalog.open();
                TablePath tablePath = TablePath.of(database, table);
                CatalogTable catalogTable = catalog.getTable(tablePath);
                log.info("Successfully retrieved catalog table: {}", catalogTable);
                return new DatabendSource(
                        catalogTable, sql, url, ssl, username, password, fetchSize);
            } catch (Exception e) {
                log.warn(
                        "Failed to get table schema from catalog, will try to infer schema from query",
                        e);
                TableSchema.Builder builder = TableSchema.builder();
                TableSchema tableSchema = builder.build();
                CatalogTable catalogTable =
                        CatalogTable.of(
                                TableIdentifier.of(catalogName, database, table),
                                tableSchema,
                                Collections.emptyMap(),
                                Collections.emptyList(),
                                "",
                                catalogName);
                return new DatabendSource(
                        catalogTable, sql, url, ssl, username, password, fetchSize);
            } finally {
                try {
                    catalog.close();
                } catch (Exception e) {

View on GitHub (pinned to cf67b549a7)