{"record":{"id":"3577ac20cfd30582","repo":"apache/seatunnel","slug":"table-not-exist-3577ac","errorCode":null,"errorMessage":"table not exist","messagePattern":"table not exist","errorType":"exception","errorClass":"TableNotExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java","lineNumber":213,"sourceCode":"        log.info(\"Dropped table at path: {}\", tablePath);\n    }\n\n    @Override\n    public void createDatabase(TablePath tablePath, boolean ignoreIfExists)\n            throws DatabaseAlreadyExistException, CatalogException {\n        // Do nothing\n    }\n\n    @Override\n    public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)\n            throws DatabaseNotExistException, CatalogException {\n        // Do nothing\n    }\n\n    @Override\n    public boolean isExistsData(TablePath tablePath) {\n        if (!tableExists(tablePath)) {\n            throw new TableNotExistException(\"table not exist\", tablePath);\n        }\n        TableIdentifier icebergTableIdentifier = toIcebergTableIdentifier(tablePath);\n        Snapshot snapshot = catalog.loadTable(icebergTableIdentifier).currentSnapshot();\n        if (snapshot != null) {\n            String total = snapshot.summary().getOrDefault(\"total-records\", null);\n            return total != null && !total.equals(\"0\");\n        }\n        return false;\n    }\n\n    @Override\n    public void executeSql(TablePath tablePath, String sql) {\n        Delete delete;\n        try {\n            Statement statement = CCJSqlParserUtil.parse(sql);\n            delete = (Delete) statement;\n        } catch (Throwable e) {\n            throw new IllegalArgumentException(","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/catalog/IcebergCatalog.java#L195-L231","documentation":"isExistsData checks whether an Iceberg table contains any records by reading the current snapshot's 'total-records' summary. As a precondition it requires the table to exist; if tableExists(tablePath) is false it throws TableNotExistException with message 'table not exist'.","triggerScenarios":"isExistsData(tablePath) is called (e.g. by sync/consistency tooling to decide incremental vs full load) with a table path that does not exist in the configured catalog.","commonSituations":"Pointing the check at a table in the wrong namespace/warehouse; table dropped before the sync job runs; namespace/table name typos; catalog configured against a different environment than expected.","solutions":["Verify the table exists at the given tablePath in the configured catalog before calling isExistsData","Correct the tablePath namespace/table spelling and environment (warehouse/URI) configuration","Create the table (or skip the data-existence check) when the table is legitimately absent"],"exampleFix":"// before checking data of a not-yet-created table\nif (catalog.isExistsData(TablePath.of(\"db\", \"metrics\"))) { ... }\n// after\nif (catalog.tableExists(TablePath.of(\"db\", \"metrics\")) && catalog.isExistsData(TablePath.of(\"db\", \"metrics\"))) { ... }","handlingStrategy":"validation","validationCode":"if (!seaTunnelCatalog.tableExists(tablePath)) {\n  // skip isExistsData or create the table first\n} else {\n  boolean hasData = seaTunnelCatalog.isExistsData(tablePath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  boolean hasData = seaTunnelCatalog.isExistsData(tablePath);\n} catch (TableNotExistException e) {\n  // treat as empty/new: create table or fall back to full load\n}","preventionTips":["Always call tableExists before isExistsData","Handle first-run scenarios where the table is legitimately absent","Keep catalog environment (warehouse path) consistent between jobs that write and jobs that check"],"tags":["iceberg","catalog","table-not-found","snapshot"],"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-14T05:17:10.506Z"}