{"record":{"id":"47383d6266142a14","repo":"apache/seatunnel","slug":"table-s-field-name-cannot-be-empty","errorCode":null,"errorMessage":"Table %s field name cannot be empty","messagePattern":"Table (.+?) field name cannot be empty","errorType":"validation","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryContext.java","lineNumber":47,"sourceCode":"import java.util.List;\n\n@Getter\npublic abstract class TableFactoryContext {\n\n    private final ReadonlyConfig options;\n    private final ClassLoader classLoader;\n\n    public TableFactoryContext(ReadonlyConfig options, ClassLoader classLoader) {\n        this.options = options;\n        this.classLoader = classLoader;\n    }\n\n    protected static void checkCatalogTableIllegal(List<CatalogTable> catalogTables) {\n        for (CatalogTable catalogTable : catalogTables) {\n            List<String> alreadyChecked = new ArrayList<>();\n            for (String fieldName : catalogTable.getTableSchema().getFieldNames()) {\n                if (StringUtils.isBlank(fieldName)) {\n                    throw new SeaTunnelException(\n                            String.format(\n                                    \"Table %s field name cannot be empty\",\n                                    catalogTable.getTablePath().getFullName()));\n                }\n                if (alreadyChecked.contains(fieldName)) {\n                    throw new SeaTunnelException(\n                            String.format(\n                                    \"Table %s field %s duplicate\",\n                                    catalogTable.getTablePath().getFullName(), fieldName));\n                }\n                alreadyChecked.add(fieldName);\n            }\n        }\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":63,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryContext.java#L29-L63","documentation":"Thrown by TableFactoryContext.checkCatalogTableIllegal while validating a CatalogTable's schema: a field name is null, empty, or whitespace-only. The factory context refuses to construct source/sink/transform plugins against a table schema with blank field names because they cannot be referenced, resolved, or mapped downstream.","triggerScenarios":"Calling TableFactoryContext (or createAndPrepareSource/Sink/Transform paths) with a CatalogTable whose TableSchema contains a blank field name — typically produced by a catalog that mis-declares columns, or by user-supplied schema/Transform definitions like 'schema { fields { \"\" = string } }' or ' '.","commonSituations":"Hand-written schema blocks in HOCON with an empty key or stray whitespace; custom Catalog building code that adds columns without names; a connector's catalog implementation deriving field names from upstream metadata that contains blanks.","solutions":["Inspect the table schema at the failing factory and give every field a non-blank name.","Fix the HOCON schema block so every key is a real column name.","If the schema comes from a custom Catalog/connector, fix its column-name derivation before building the CatalogTable.","Validate programmatically with catalogTable.getTableSchema().getFieldNames() before passing to the factory."],"exampleFix":"// before\nschema { fields { \"\" = string, name = string } }\n// after\nschema { fields { id = string, name = string } }","handlingStrategy":"validation","validationCode":"boolean ok = catalogTables.stream().allMatch(t -> Arrays.stream(t.getTableSchema().getFieldNames()).allMatch(n -> n != null && !n.isBlank()));","typeGuard":"boolean hasBlank = schema.getFieldNames() == null || Arrays.stream(schema.getFieldNames()).anyMatch(n -> n == null || n.isBlank());","tryCatchPattern":"try { factory.createAndPrepareSource(...) } catch (SeaTunnelException e) { if (e.getMessage().contains(\"field name cannot be empty\")) { log.error(\"schema has blank field names\"); } throw e; }","preventionTips":["Lint HOCON schema blocks for empty keys","Validate CatalogTable schemas when building them in code","Add schema unit tests for catalog implementations"],"tags":["schema","validation","catalog-table","field-name"],"backgroundTag":"schema-validation-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"}