{"record":{"id":"f3f2f7128a29bab2","repo":"apache/seatunnel","slug":"can-t-find-field-s","errorCode":null,"errorMessage":"can't find field [%s]","messagePattern":"can't find field \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRowType.java","lineNumber":87,"sourceCode":"        return fieldNames[index];\n    }\n\n    public SeaTunnelDataType<?> getFieldType(int index) {\n        return fieldTypes[index];\n    }\n\n    public int indexOf(String fieldName) {\n        return indexOf(fieldName, true);\n    }\n\n    public int indexOf(String fieldName, boolean throwExceptionWhenNotFound) {\n        for (int i = 0; i < fieldNames.length; i++) {\n            if (fieldNames[i].equals(fieldName)) {\n                return i;\n            }\n        }\n        if (throwExceptionWhenNotFound) {\n            throw new IllegalArgumentException(String.format(\"can't find field [%s]\", fieldName));\n        } else {\n            return -1;\n        }\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (!(obj instanceof SeaTunnelRowType)) {\n            return false;\n        }\n        SeaTunnelRowType that = (SeaTunnelRowType) obj;\n        return Arrays.equals(fieldNames, that.fieldNames)\n                && Arrays.equals(fieldTypes, that.fieldTypes);\n    }\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRowType.java#L69-L105","documentation":"SeaTunnelRowType.indexOf(fieldName, throwExceptionWhenNotFound) scans fieldNames for an exact match and throws IllegalArgumentException when the field is absent and exception mode is on. It's the standard way to resolve a column name to an index in a row type.","triggerScenarios":"Calling indexOf(\"col\", true), or the strict wrappers (fieldIndex, requireFieldIndex, index, etc.), with a column name that does not exactly equal any field name in the SeaTunnelRowType — including case or whitespace differences.","commonSituations":"Upstream schema changed and a column was renamed/dropped; lookup with the wrong casing ('Name' vs 'name'); key-by-name lookups in sinks/transforms where config column names don't match the declared schema.","solutions":["Verify the exact field name against rowType.getFieldNames() and fix casing/spelling","Use indexOf(fieldName, false) to probe existence (returns -1) before strict access","Compare with the output of the previous transform — schema changes upstream may have renamed fields","Use case-insensitive matching yourself by scanning getFieldNames() if the source has inconsistent casing"],"exampleFix":"// before\nint idx = rowType.indexOf(\"userName\", true); // throws if field absent\n// after\nint idx = rowType.indexOf(\"userName\", false);\nif (idx < 0) {\n    idx = rowType.indexOf(\"user_name\", true); // fallback naming convention\n}","handlingStrategy":"validation","validationCode":"int idx = rowType.indexOf(fieldName, false);\nif (idx < 0) {\n    throw new ConfigException(\"Column '\" + fieldName + \"' not in schema: \"\n        + Arrays.toString(rowType.getFieldNames()));\n}","typeGuard":null,"tryCatchPattern":"try {\n    int idx = rowType.indexOf(name, true);\n} catch (IllegalArgumentException e) {\n    // resolve case-insensitively or fail with schema context\n}","preventionTips":["Always cross-check configured column names against the actual schema at job startup","Beware of upstream schema changes renaming/dropping columns","Normalize casing early if sources are inconsistent","Prefer indexOf(name, false) + explicit handling over blind strict lookups"],"tags":["schema","field-lookup","argument"],"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-23T08:17:48.524Z"}