{"record":{"id":"370a9b4e07cb68f5","repo":"apache/flink","slug":"pos-370a9b","errorCode":null,"errorMessage":"{pos}","messagePattern":"\\{pos\\}","errorType":"exception","errorClass":"IndexOutOfBoundsException","httpStatus":null,"severity":"error","filePath":"flink-core-api/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java","lineNumber":129,"sourceCode":"    @SuppressWarnings(\"unchecked\")\n    public <T> T getField(int pos) {\n        switch (pos) {\n            case 0:\n                return (T) this.f0;\n            case 1:\n                return (T) this.f1;\n            case 2:\n                return (T) this.f2;\n            case 3:\n                return (T) this.f3;\n            case 4:\n                return (T) this.f4;\n            case 5:\n                return (T) this.f5;\n            case 6:\n                return (T) this.f6;\n            default:\n                throw new IndexOutOfBoundsException(String.valueOf(pos));\n        }\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public <T> void setField(T value, int pos) {\n        switch (pos) {\n            case 0:\n                this.f0 = (T0) value;\n                break;\n            case 1:\n                this.f1 = (T1) value;\n                break;\n            case 2:\n                this.f2 = (T2) value;\n                break;\n            case 3:\n                this.f3 = (T3) value;","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core-api/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java#L111-L147","documentation":"Tuple7.getField(int pos) throws IndexOutOfBoundsException when the requested field position is outside 0..6. Tuples are fixed-arity, so any position greater than the last field (f6) or negative is invalid. The exception message is just the bad position value.","triggerScenarios":"Calling getField(7) or a negative index on Tuple7; iterating field positions taken from a larger tuple's arity; translating 1-based external field numbers directly into this 0-based API.","commonSituations":"Schema evolution where a Tuple8 position list is applied to a Tuple7; positional access driven by SQL/Table projection indices that no longer match the tuple arity; loop bounds off by one (`i <= getArity()`).","solutions":["Use positions 0..6 for Tuple7.getField","Bounds-check against tuple.getArity() before calling","Validate externally supplied field indices once, at ingestion, with a clear error message","Use tuple.f0..tuple.f6 directly when the field is known statically"],"exampleFix":"// before\nObject v = tuple7.getField(7);\n\n// after\nObject v = (pos >= 0 && pos < tuple7.getArity()) ? tuple7.getField(pos) : null;","handlingStrategy":"validation","validationCode":"if (pos < 0 || pos >= tuple7.getArity()) {\n    throw new IllegalArgumentException(\"pos \" + pos + \" outside Tuple7 arity 7\");\n}\nObject v = tuple7.getField(pos);","typeGuard":null,"tryCatchPattern":"catch (IndexOutOfBoundsException e) { /* log the index source (projection list, config) and rethrow */ }","preventionTips":["Use 0-based positions 0..6","Convert 1-based external column numbers with pos - 1 and range-check","Bound field loops by getArity(), never by a hardcoded constant from another tuple type"],"tags":["tuple","index-out-of-bounds","flink-core-api","validation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}