{"record":{"id":"eb5c9cc628e1303b","repo":"apache/seatunnel","slug":"cannot-find-field-s-in-s","errorCode":null,"errorMessage":"Cannot find field %s in %s","messagePattern":"Cannot find field (.+?) in (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/sink/writer/RecordProjection.java","lineNumber":122,"sourceCode":"                            Preconditions.checkArgument(\n                                    elementProjectable,\n                                    \"Cannot project a partial list element struct. Trying to project %s out of %s\",\n                                    projectedField,\n                                    dataField);\n\n                            nestedProjections[pos] = null;\n                            break;\n                        default:\n                            nestedProjections[pos] = null;\n                    }\n                }\n            }\n\n            if (!found && projectedField.isOptional() && allowMissing) {\n                positionMap[pos] = -1;\n                nestedProjections[pos] = null;\n            } else if (!found) {\n                throw new IllegalArgumentException(\n                        String.format(\"Cannot find field %s in %s\", projectedField, structType));\n            }\n        }\n    }\n\n    public RecordProjection wrap(IcebergRecord newRecord) {\n        this.record = newRecord;\n        return this;\n    }\n\n    @Override\n    public int size() {\n        return type.fields().size();\n    }\n\n    @Override\n    public <T> T get(int pos, Class<T> javaClass) {\n        // struct can be null if wrap is not called first before the get call","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/sink/writer/RecordProjection.java#L104-L140","documentation":"RecordProjection builds a position map projecting an Iceberg record onto a requested (projected) schema. When a projected field cannot be found in the record's struct type, and it is not optional-with-allowMissing, projection fails with this IllegalArgumentException. It protects readers from silently producing nulls for required fields.","triggerScenarios":"Query/projected schema contains a field that does not exist in the table's current schema at read time — e.g. schema evolved (field renamed/dropped) after a split was planned, or a projection column name mismatch.","commonSituations":"Table schema changed between split enumeration and reading (checkpoint restore with stale splits); requesting fields in the SeaTunnel catalog schema that were removed from the Iceberg table; case-sensitive field name mismatches.","solutions":["Refresh table schema and re-plan splits so projections match the current table schema","Check the SeaTunnel catalog/table column list matches the actual Iceberg schema (names are case-sensitive)","If the field is legitimately nullable/absent, mark it optional in the projected schema so allowMissing applies","Restore from a checkpoint after a schema change: cancel the job, correct the query schema, and restart"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate projected fields exist in the table schema before reading\nSchema tableSchema = table.schema();\nfor (String col : projectedColumns) {\n    if (tableSchema.findField(col) == null) throw new IllegalArgumentException(\"Unknown column: \" + col);\n}","typeGuard":null,"tryCatchPattern":"try { reader.next(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Cannot find field\")) { /* resync schema, re-plan splits */ } throw e; }","preventionTips":["Keep catalog schemas in sync with Iceberg table schema","Avoid renaming/dropping Iceberg fields while streaming jobs are running","Restore jobs only against checkpoints from the same table schema version","Remember field lookups are case-sensitive"],"tags":["iceberg","schema","projection"],"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-23T08:17:48.524Z"}