apache/seatunnel · error · IllegalArgumentException

Cannot find field in

Error message

Cannot find field %s in %s

What it means

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.

Solutions

  1. Refresh table schema and re-plan splits so projections match the current table schema
  2. Check the SeaTunnel catalog/table column list matches the actual Iceberg schema (names are case-sensitive)
  3. If the field is legitimately nullable/absent, mark it optional in the projected schema so allowMissing applies
  4. Restore from a checkpoint after a schema change: cancel the job, correct the query schema, and restart
Defensive patterns

Strategy: validation

Validate before calling

// Validate projected fields exist in the table schema before reading
Schema tableSchema = table.schema();
for (String col : projectedColumns) {
    if (tableSchema.findField(col) == null) throw new IllegalArgumentException("Unknown column: " + col);
}

Try / catch

try { reader.next(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Cannot find field")) { /* resync schema, re-plan splits */ } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/eb5c9cc628e1303b. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/sink/writer/RecordProjection.java:122

                            Preconditions.checkArgument(
                                    elementProjectable,
                                    "Cannot project a partial list element struct. Trying to project %s out of %s",
                                    projectedField,
                                    dataField);

                            nestedProjections[pos] = null;
                            break;
                        default:
                            nestedProjections[pos] = null;
                    }
                }
            }

            if (!found && projectedField.isOptional() && allowMissing) {
                positionMap[pos] = -1;
                nestedProjections[pos] = null;
            } else if (!found) {
                throw new IllegalArgumentException(
                        String.format("Cannot find field %s in %s", projectedField, structType));
            }
        }
    }

    public RecordProjection wrap(IcebergRecord newRecord) {
        this.record = newRecord;
        return this;
    }

    @Override
    public int size() {
        return type.fields().size();
    }

    @Override
    public <T> T get(int pos, Class<T> javaClass) {
        // struct can be null if wrap is not called first before the get call

View on GitHub (pinned to cf67b549a7)