{"record":{"id":"d78f1cc301b0c4b8","repo":"apache/seatunnel","slug":"tablename-cannot-be-empty","errorCode":null,"errorMessage":"tableName cannot be empty","messagePattern":"tableName cannot be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableIdentifier.java","lineNumber":48,"sourceCode":"public final class TableIdentifier implements Serializable {\n    private static final long serialVersionUID = 1L;\n\n    private final String catalogName;\n\n    private final String databaseName;\n\n    private final String schemaName;\n\n    @NonNull private final String tableName;\n\n    public TableIdentifier(\n            String catalogName, String databaseName, String schemaName, @NonNull String tableName) {\n        this.catalogName = catalogName;\n        this.databaseName = databaseName;\n        this.schemaName = schemaName;\n        this.tableName = tableName;\n        if (StringUtils.isEmpty(tableName)) {\n            throw new IllegalArgumentException(\"tableName cannot be empty\");\n        }\n    }\n\n    public static TableIdentifier of(String catalogName, String databaseName, String tableName) {\n        return new TableIdentifier(catalogName, databaseName, null, tableName);\n    }\n\n    public static TableIdentifier of(String catalogName, TablePath tablePath) {\n        return new TableIdentifier(\n                catalogName,\n                tablePath.getDatabaseName(),\n                tablePath.getSchemaName(),\n                tablePath.getTableName());\n    }\n\n    public static TableIdentifier of(\n            String catalogName, String databaseName, String schemaName, String tableName) {\n        return new TableIdentifier(catalogName, databaseName, schemaName, tableName);","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableIdentifier.java#L30-L66","documentation":"The TableIdentifier constructor requires a non-empty tableName. After Lombok @NonNull, it explicitly checks StringUtils.isEmpty(tableName) and throws IllegalArgumentException to guarantee every table identifier names a table. TableIdentifier is the key used to identify tables across catalogs, so an empty name would be invalid.","triggerScenarios":"Calling new TableIdentifier(catalog, db, schema, \"\") or TableIdentifier.of(...) with an empty/null tableName (null trips @NonNull first; empty string trips the isEmpty check).","commonSituations":"Building identifiers from parsed table paths where a segment is missing (e.g. splitting \"db.\" or \".table\"), dynamic table names taken from empty config fields, or default-initialized string variables.","solutions":["Pass a non-empty tableName when constructing TableIdentifier","Validate/trim the table name from configs before calling of()/constructor","If the table is genuinely unknown, fail earlier with a clearer error at config-parse time"],"exampleFix":"// before\nTableIdentifier.of(\"MySQL\", \"shop\", config.get(\"table\")); // config value \"\"\n// after\nString table = config.getString(\"table\");\nif (table == null || table.isEmpty()) throw new IllegalArgumentException(\"table config is required\");\nTableIdentifier.of(\"MySQL\", \"shop\", table);","handlingStrategy":"validation","validationCode":"if (tableName == null || tableName.trim().isEmpty()) throw new IllegalArgumentException(\"tableName required\");\nTableIdentifier id = TableIdentifier.of(catalog, db, tableName);","typeGuard":null,"tryCatchPattern":"try { return TableIdentifier.of(catalog, db, table); } catch (IllegalArgumentException e) { log.error(\"Cannot build TableIdentifier: {}\", e.getMessage()); throw e; }","preventionTips":["Validate table name from config/env before constructing identifiers","Trim whitespace from table names","Fail early at config-parse time rather than at identifier construction"],"tags":["table-identifier","validation","empty-string"],"backgroundTag":"empty-required-field","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"}