{"record":{"id":"9305032bba442e26","repo":"apache/seatunnel","slug":"table-not-existed-930503","errorCode":"TABLE_NOT_EXISTED","errorMessage":"Table %s does not exist in Catalog %s.","messagePattern":"Table (.+?) does not exist in Catalog (.+?)\\.","errorType":"error_code","errorClass":"TableNotExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java","lineNumber":596,"sourceCode":"        String dbUrl = getUrlFromDatabaseName(databaseName);\n        try {\n            Connection connection = connectionMap.remove(dbUrl);\n            if (connection != null) {\n                connection.close();\n            }\n        } catch (SQLException e) {\n            throw new CatalogException(String.format(\"Failed to close %s via JDBC.\", dbUrl), e);\n        }\n    }\n\n    public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)\n            throws TableNotExistException, CatalogException {\n        checkNotNull(tablePath, \"Table path cannot be null\");\n        if (!tableExists(tablePath)) {\n            if (ignoreIfNotExists) {\n                return;\n            }\n            throw new TableNotExistException(catalogName, tablePath);\n        }\n        truncateTableInternal(tablePath);\n    }\n\n    @Override\n    public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)\n            throws DatabaseNotExistException, CatalogException {\n        checkNotNull(tablePath, \"Table path cannot be null\");\n        checkNotNull(tablePath.getDatabaseName(), \"Database name cannot be null\");\n\n        if (!databaseExists(tablePath.getDatabaseName())) {\n            if (ignoreIfNotExists) {\n                return;\n            }\n            throw new DatabaseNotExistException(catalogName, tablePath.getDatabaseName());\n        }\n        dropDatabaseInternal(tablePath.getDatabaseName());\n    }","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java#L578-L614","documentation":"TableNotExistException (code TABLE_NOT_EXISTED) is thrown by truncateTable when tableExists() reports the table missing and ignoreIfNotExists is false. The catalog refuses to run TRUNCATE on a non-existent table.","triggerScenarios":"Calling catalog.truncateTable(tablePath, false) for a table path that does not exist in the catalog (wrong database/table name, wrong catalog, or table dropped concurrently).","commonSituations":"Typo in table or database name; job configured for a different catalog/database than expected; table dropped by another process between check and truncate; case-sensitivity mismatch in identifiers.","solutions":["Verify the table exists: catalog.tableExists(tablePath).","Pass ignoreIfNotExists=true if truncation is optional.","Correct the TablePath database/table names (check case sensitivity).","Confirm you are connected to the intended catalog/database environment."],"exampleFix":"// before\ncatalog.truncateTable(TablePath.of(\"db\", \"TBL\"), false);\n// after\nTablePath path = TablePath.of(\"db\", \"tbl\"); // correct case\nif (catalog.tableExists(path)) {\n    catalog.truncateTable(path, false);\n}","handlingStrategy":"validation","validationCode":"if (!catalog.tableExists(tablePath)) { if (!ignore) throw ...; return; }","typeGuard":null,"tryCatchPattern":"try { catalog.truncateTable(path, false); } catch (TableNotExistException e) { LOG.warn(\"Table {} not found in {}; skipping truncate\", path.getFullName(), catalogName); }","preventionTips":["Verify tableExists before truncating","Use ignoreIfNotExists=true for optional truncation","Check identifier case sensitivity","Confirm the correct catalog/database environment"],"tags":["jdbc","catalog","table-not-found","truncate"],"backgroundTag":"table-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}