{"record":{"id":"9d123c6d7f4a8577","repo":"apache/seatunnel","slug":"listdatabases-exist-error","errorCode":null,"errorMessage":"listDatabases exist error","messagePattern":"listDatabases exist error","errorType":"exception","errorClass":"org.apache.seatunnel.api.table.catalog.exception.CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java","lineNumber":112,"sourceCode":"            Odps odps = getOdps(readonlyConfig.get(MaxcomputeBaseOptions.PROJECT));\n            Projects projects = odps.projects();\n            return projects.exists(databaseName);\n        } catch (OdpsException e) {\n            throw new CatalogException(\"Check \" + databaseName + \" exist error\", e);\n        }\n    }\n\n    @Override\n    public List<String> listDatabases() throws CatalogException {\n        try {\n            // todo: how to get all projects\n            String project = readonlyConfig.get(MaxcomputeBaseOptions.PROJECT);\n            if (databaseExists(project)) {\n                return Lists.newArrayList(project);\n            }\n            return Collections.emptyList();\n        } catch (Exception e) {\n            throw new CatalogException(\"listDatabases exist error\", e);\n        }\n    }\n\n    @Override\n    public List<String> listTables(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        Odps odps = getOdps(databaseName);\n\n        Tables tables = odps.tables();\n        List<String> tableNames = new ArrayList<>();\n        tables.forEach(\n                table -> {\n                    tableNames.add(table.getName());\n                });\n        return tableNames;\n    }\n\n    @Override","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalog.java#L94-L130","documentation":"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.","triggerScenarios":"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\").","commonSituations":"Misconfigured readonlyConfig (missing PROJECT option); MaxCompute endpoint unreachable; expired credentials; permission denied on project lookup.","solutions":["Inspect the wrapped cause exception for the root reason","Verify MaxcomputeBaseOptions.PROJECT and credentials are set correctly in readonlyConfig","Re-test with valid access keys and the correct regional endpoint","Ensure network access from the SeaTunnel worker nodes to MaxCompute"],"exampleFix":"// before\n// catalog config without project\nMaxcomputeCatalog catalog = new MaxcomputeCatalog(\"maxcompute\", \"default\");\ncatalog.setReadOnlyConfig(new ReadonlyConfig(new HashMap<>())); // PROJECT missing\ncatalog.listDatabases(); // throws\n// after\nMap<String,Object> cfg = new HashMap<>();\ncfg.put(\"project\", \"my_proj\");\ncfg.put(\"accessId\", \"ak\");\ncfg.put(\"accessKey\", \"sk\");\ncfg.put(\"endpoint\", \"http://service.cn-hangzhou.maxcompute.aliyun.com/api\");\ncatalog.setReadOnlyConfig(new ReadonlyConfig(cfg));\ncatalog.listDatabases(); // [\"my_proj\"]","handlingStrategy":"try-catch","validationCode":"Map<String,Object> cfg = readonlyConfig.toMap();\njava.util.List<String> required = java.util.Arrays.asList(\"project\", \"accessId\", \"accessKey\", \"endpoint\");\nfor (String key : required) {\n    if (!cfg.containsKey(key) || cfg.get(key) == null) {\n        throw new IllegalArgumentException(\"Missing MaxCompute config: \" + key);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    List<String> dbs = catalog.listDatabases();\n} catch (CatalogException e) {\n    LOG.error(\"Failed to list MaxCompute databases; check credentials/endpoint\", e);\n    throw new JobExecutionException(\"Catalog initialization failed\", e);\n}","preventionTips":["Validate all MaxCompute options (project, accessId, accessKey, endpoint) at job startup","Keep credentials in a secrets manager rather than plaintext config","Pin the correct regional endpoint for your project","Smoke-test the catalog with a listDatabases call before running pipelines"],"tags":["maxcompute","catalog","odps","configuration"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}