{"record":{"id":"19dcd48359b17056","repo":"apache/seatunnel","slug":"check-databasename-exist-error","errorCode":null,"errorMessage":"Check ${databaseName} exist error","messagePattern":"Check (.+?) 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":98,"sourceCode":"\n    @Override\n    public String name() {\n        return catalogName;\n    }\n\n    @Override\n    public String getDefaultDatabase() throws CatalogException {\n        return readonlyConfig.get(MaxcomputeBaseOptions.PROJECT);\n    }\n\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        try {\n            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","sourceCodeStart":80,"sourceCodeEnd":116,"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#L80-L116","documentation":"MaxComputeCatalog.databaseExists wraps any OdpsException from the MaxCompute SDK projects().exists() call into a CatalogException with this message. It means the existence check against the MaxCompute project (database) failed at the network/API level, not that the project does not exist.","triggerScenarios":"listDatabases calls databaseExists(project); the SDK call odps.projects().exists(databaseName) throws OdpsException due to connectivity, auth, or missing project permissions.","commonSituations":"Wrong endpoint/tunnel URL or unreachable MaxCompute region; invalid accessKey/accessKeySecret; project name typo; account lacks List permission on the project; network/firewall blocking the endpoint.","solutions":["Check the cause (OdpsException) for the real error: auth, network, or permission","Verify endpoint, project, access-key-id and access-key-secret in the sink/source options","Confirm the account has permission to view the project in the MaxCompute console","Test connectivity from the runtime host (curl the MaxCompute endpoint)"],"exampleFix":"// before\n// options missing endpoint -> SDK uses default and fails\nMaxcomputeOptions options = MaxcomputeOptions.builder()\n    .withProject(\"my_proj\")\n    .withAccessId(\"ak\")\n    .withAccessKey(\"sk\")\n    .build();\n// after\nMaxcomputeOptions options = MaxcomputeOptions.builder()\n    .withProject(\"my_proj\")\n    .withEndpoint(\"http://service.cn-hangzhou.maxcompute.aliyun.com/api\")\n    .withAccessId(\"ak\")\n    .withAccessKey(\"sk\")\n    .build();","handlingStrategy":"try-catch","validationCode":"// before calling catalog ops, verify config completeness\nif (readonlyConfig.get(MaxcomputeBaseOptions.PROJECT) == null) {\n    throw new IllegalArgumentException(\"MaxCompute 'project' option is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    catalog.listDatabases();\n} catch (CatalogException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof OdpsException && String.valueOf(cause.getMessage()).contains(\"SignatureDoesNotMatch\")) {\n        throw new IllegalStateException(\"Invalid MaxCompute credentials\", e);\n    }\n    throw e; // network/permission errors are not safely retryable here\n}","preventionTips":["Verify endpoint/project/access-key settings before submitting the job","Test credentials with odpscmd or the console first","Ensure worker nodes can reach the MaxCompute endpoint (firewall/VPC)","Grant the account List/View permissions on the project"],"tags":["maxcompute","catalog","odps","network"],"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"}