{"record":{"id":"242f6d693c458887","repo":"apache/seatunnel","slug":"databasenotexistexception-catalogname-databasena","errorCode":null,"errorMessage":"DatabaseNotExistException: catalogName, databaseName","messagePattern":"DatabaseNotExistException: catalogName, databaseName","errorType":"error_code","errorClass":"DatabaseNotExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java","lineNumber":172,"sourceCode":"                    String databaseName = resultSet.getString(\"TABLE_SCHEM\");\n                    databases.add(databaseName);\n                }\n            }\n            return databases;\n        } catch (SQLException e) {\n            throw new DatabendConnectorException(\n                    DatabendConnectorErrorCode.SQL_OPERATION_FAILED,\n                    \"Failed to list databases: \" + e.getMessage(),\n                    e);\n        }\n    }\n\n    @Override\n    public List<String> listTables(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        checkOpen();\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(catalogName, databaseName);\n        }\n\n        try (Connection connection = getConnection()) {\n            DatabaseMetaData metaData = connection.getMetaData();\n            List<String> tables = new ArrayList<>();\n            try (ResultSet resultSet =\n                    metaData.getTables(null, databaseName, null, new String[] {\"TABLE\"})) {\n                while (resultSet.next()) {\n                    String tableName = resultSet.getString(\"TABLE_NAME\");\n                    tables.add(tableName);\n                }\n            }\n            return tables;\n        } catch (SQLException e) {\n            throw new DatabendConnectorException(\n                    DatabendConnectorErrorCode.SQL_OPERATION_FAILED,\n                    \"Failed to list tables: \" + e.getMessage(),\n                    e);","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java#L154-L190","documentation":"DatabendCatalog.listTables() first calls databaseExists(databaseName); when that returns false it throws SeaTunnel's standard DatabaseNotExistException for (catalogName, databaseName). This is the API-declared checked exception meaning the requested database/schema does not exist in the Databend catalog.","triggerScenarios":"Calling listTables with a databaseName that does not exist in Databend — misspelled schema name, wrong case (lookups are case-insensitive equalsIgnoreCase but the DB genuinely is absent), or connecting to a different Databend instance/tenant than intended.","commonSituations":"Config references a database that was dropped, dev-vs-prod environment mismatch, database created in another warehouse/tenant, or name typo in the SeaTunnel job config.","solutions":["Run SHOW DATABASES on the target Databend instance and confirm the exact schema name, then correct databaseName in the job config.","Create the database first (CREATE DATABASE ...) or have the pipeline create it via createDatabase before listing tables.","Verify the catalog URL points at the environment you expect (dev vs prod, correct tenant)."],"exampleFix":"// before\nlistTables(\"my_databse\") // typo\n// after\nlistTables(\"my_database\") // matches SHOW DATABASES output","handlingStrategy":"validation","validationCode":"// before calling listTables\nSHOW DATABASES; -- confirm exact schema name, then compare in code\nif (!databases.stream().anyMatch(d -> d.equalsIgnoreCase(targetDb))) {\n  throw new IllegalArgumentException(\"database not found: \" + targetDb);\n}","typeGuard":null,"tryCatchPattern":"try {\n  tables = catalog.listTables(db);\n} catch (DatabaseNotExistException e) {\n  log.warn(\"db {} missing, creating it\", db);\n  catalog.createDatabase(db, false);\n  tables = catalog.listTables(db);\n}","preventionTips":["Copy database names from SHOW DATABASES output rather than typing them","Create the target database as a pipeline prerequisite step","Confirm which environment (dev/prod/tenant) the catalog URL points to","Use consistent naming conventions across job configs"],"tags":["databend","catalog","database-not-exist","metadata"],"backgroundTag":"resource-not-found","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"}