{"record":{"id":"72a3f9e9bfb5b6ed","repo":"apache/flink","slug":"invalid-format-of-tuple-field-expression","errorCode":null,"errorMessage":"Invalid format of tuple field expression \"{}\".","messagePattern":"Invalid format of tuple field expression \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidFieldReferenceException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfoBase.java","lineNumber":194,"sourceCode":"                                    + \"\\\" not possible on atomic type \"\n                                    + fieldType\n                                    + \".\");\n                }\n            }\n        }\n    }\n\n    @Override\n    public <X> TypeInformation<X> getTypeAt(String fieldExpression) {\n\n        Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression);\n        if (!matcher.matches()) {\n            if (fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR)\n                    || fieldExpression.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA)) {\n                throw new InvalidFieldReferenceException(\n                        \"Wildcard expressions are not allowed here.\");\n            } else {\n                throw new InvalidFieldReferenceException(\n                        \"Invalid format of tuple field expression \\\"\" + fieldExpression + \"\\\".\");\n            }\n        }\n\n        String fieldStr = matcher.group(1);\n        Matcher fieldMatcher = PATTERN_FIELD.matcher(fieldStr);\n        if (!fieldMatcher.matches()) {\n            throw new RuntimeException(\"Invalid matcher pattern\");\n        }\n        String field = fieldMatcher.group(2);\n        int fieldPos = Integer.valueOf(field);\n\n        if (fieldPos >= this.getArity()) {\n            throw new InvalidFieldReferenceException(\n                    \"Tuple field expression \\\"\"\n                            + fieldStr\n                            + \"\\\" out of bounds of \"\n                            + this.toString()","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfoBase.java#L176-L212","documentation":"Thrown by TupleTypeInfoBase.getTypeAt(String) when the field expression does not match PATTERN_NESTED_FIELDS. The expected format is an integer with optional 'f' prefix (e.g. '0', 'f0', 'f2'), optionally followed by a dot and a nested expression (e.g. 'f0.name'). Any string that deviates from this pattern (and is not a wildcard) triggers this error.","triggerScenarios":"Calling tupleType.getTypeAt(\"name\") on a TupleTypeInfoBase (use PojoTypeInfo for named fields). Calling getTypeAt(\"field1\"). Calling getTypeAt(\"f0.f1.f2\") when a nested field is not a CompositeType.","commonSituations":"Developer treats a Tuple as a POJO and tries to access fields by name. Confusion between Tuple field selectors (integer indices) and POJO field selectors (string names). Passing a Row field name to a Tuple type. Off-by-one or typo in the field expression string.","solutions":["Use a numeric field expression: 'f0', 'f1', ..., 'f{arity-1}' or plain '0', '1', ...","If the type is actually a POJO, use PojoTypeInfo.getTypeAt(String) which accepts field names.","If the type is a Row, use RowTypeInfo.getTypeAt(String) which accepts both field names and indices.","Double-check the TypeInformation subtype at runtime before calling getTypeAt."],"exampleFix":"// before\ntupleType.getTypeAt(\"myField\");\n// after\ntupleType.getTypeAt(\"f0\");","handlingStrategy":"validation","validationCode":"private static final Pattern TUPLE_FIELD = Pattern.compile(\"(f?)([0-9]+)(\\\\.(.+))?\");\nif (!TUPLE_FIELD.matcher(fieldExpr).matches()) {\n    throw new IllegalArgumentException(\"Invalid tuple field expression: \" + fieldExpr);\n}\ntupleType.getTypeAt(fieldExpr);","typeGuard":"static boolean isValidTupleFieldExpression(String expr) {\n    return expr != null && expr.matches(\"(f?)([0-9]+)(\\\\.(.+))?\");\n}","tryCatchPattern":null,"preventionTips":["Validate field expressions with the tuple regex before calling getTypeAt.","Use integer-based getTypeAt(int pos) when the field index is known numerically.","Remember Tuple fields are accessed by index (f0, f1, ...), not by name."],"tags":["type-extraction","tuple","field-expression","invalid-format"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}