apache/seatunnel · error · org.apache.seatunnel.api.table.catalog.exception.CatalogException

listDatabases exist error

Error message

listDatabases exist error

What it means

MaxComputeCatalog.listDatabases wraps any Exception raised while listing databases (here: checking the configured project exists) into a CatalogException with this message. The implementation only ever returns the single configured project, so any failure in that existence check propagates here.

Source

Thrown at seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java:112

            Odps odps = getOdps(readonlyConfig.get(MaxcomputeBaseOptions.PROJECT));
            Projects projects = odps.projects();
            return projects.exists(databaseName);
        } catch (OdpsException e) {
            throw new CatalogException("Check " + databaseName + " exist error", e);
        }
    }

    @Override
    public List<String> listDatabases() throws CatalogException {
        try {
            // todo: how to get all projects
            String project = readonlyConfig.get(MaxcomputeBaseOptions.PROJECT);
            if (databaseExists(project)) {
                return Lists.newArrayList(project);
            }
            return Collections.emptyList();
        } catch (Exception e) {
            throw new CatalogException("listDatabases exist error", e);
        }
    }

    @Override
    public List<String> listTables(String databaseName)
            throws CatalogException, DatabaseNotExistException {
        Odps odps = getOdps(databaseName);

        Tables tables = odps.tables();
        List<String> tableNames = new ArrayList<>();
        tables.forEach(
                table -> {
                    tableNames.add(table.getName());
                });
        return tableNames;
    }

    @Override

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the wrapped cause exception for the root reason
  2. Verify MaxcomputeBaseOptions.PROJECT and credentials are set correctly in readonlyConfig
  3. Re-test with valid access keys and the correct regional endpoint
  4. Ensure network access from the SeaTunnel worker nodes to MaxCompute

Example fix

// before
// catalog config without project
MaxcomputeCatalog catalog = new MaxcomputeCatalog("maxcompute", "default");
catalog.setReadOnlyConfig(new ReadonlyConfig(new HashMap<>())); // PROJECT missing
catalog.listDatabases(); // throws
// after
Map<String,Object> cfg = new HashMap<>();
cfg.put("project", "my_proj");
cfg.put("accessId", "ak");
cfg.put("accessKey", "sk");
cfg.put("endpoint", "http://service.cn-hangzhou.maxcompute.aliyun.com/api");
catalog.setReadOnlyConfig(new ReadonlyConfig(cfg));
catalog.listDatabases(); // ["my_proj"]
Defensive patterns

Strategy: try-catch

Validate before calling

Map<String,Object> cfg = readonlyConfig.toMap();
java.util.List<String> required = java.util.Arrays.asList("project", "accessId", "accessKey", "endpoint");
for (String key : required) {
    if (!cfg.containsKey(key) || cfg.get(key) == null) {
        throw new IllegalArgumentException("Missing MaxCompute config: " + key);
    }
}

Try / catch

try {
    List<String> dbs = catalog.listDatabases();
} catch (CatalogException e) {
    LOG.error("Failed to list MaxCompute databases; check credentials/endpoint", e);
    throw new JobExecutionException("Catalog initialization failed", e);
}

Prevention

When it happens

Trigger: listDatabases calls databaseExists(project), which throws (or any other Exception occurs, e.g. config missing); caught by catch(Exception) and rethrown as CatalogException("listDatabases exist error").

Common situations: Misconfigured readonlyConfig (missing PROJECT option); MaxCompute endpoint unreachable; expired credentials; permission denied on project lookup.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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