{"record":{"id":"fd849d913dccf62e","repo":"apache/flink","slug":"invalid-tuple-field-reference","errorCode":null,"errorMessage":"Invalid tuple field reference \"{}\".","messagePattern":"Invalid tuple field reference \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidFieldReferenceException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java","lineNumber":106,"sourceCode":"    }\n\n    public RowTypeInfo(TypeInformation<?>[] types, String[] fieldNames) {\n        super(Row.class, types);\n        checkNotNull(fieldNames, \"FieldNames should not be null.\");\n        checkArgument(\n                types.length == fieldNames.length, \"Number of field types and names is different.\");\n        checkArgument(!hasDuplicateFieldNames(fieldNames), \"Field names are not unique.\");\n\n        this.fieldNames = Arrays.copyOf(fieldNames, fieldNames.length);\n    }\n\n    @Override\n    public void getFlatFields(\n            String fieldExpression, int offset, List<FlatFieldDescriptor> result) {\n        Matcher matcher = PATTERN_NESTED_FIELDS_WILDCARD.matcher(fieldExpression);\n\n        if (!matcher.matches()) {\n            throw new InvalidFieldReferenceException(\n                    \"Invalid tuple field reference \\\"\" + fieldExpression + \"\\\".\");\n        }\n\n        String field = matcher.group(0);\n\n        if ((field.equals(ExpressionKeys.SELECT_ALL_CHAR))\n                || (field.equals(ExpressionKeys.SELECT_ALL_CHAR_SCALA))) {\n            // handle select all\n            int keyPosition = 0;\n            for (TypeInformation<?> fType : types) {\n                if (fType instanceof CompositeType) {\n                    CompositeType<?> cType = (CompositeType<?>) fType;\n                    cType.getFlatFields(\n                            ExpressionKeys.SELECT_ALL_CHAR, offset + keyPosition, result);\n                    keyPosition += cType.getTotalFields() - 1;\n                } else {\n                    result.add(new FlatFieldDescriptor(offset + keyPosition, fType));\n                }","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java#L88-L124","documentation":"Thrown by RowTypeInfo.getFlatFields when the fieldExpression does not match Row's field regex (which accepts integer indices like '0', string names like 'f0'/'userName', dotted nested expressions, or '*'/'_' wildcards). Note the message says 'tuple' — this is a legacy wording in the RowTypeInfo code. This is an InvalidFieldReferenceException.","triggerScenarios":"Calling tableEnv or DataStream operations on a Row-typed stream with keyBy(\"field-name\"), getFlatFields(\"\"), or getFlatFields(\"a.\"). Row field names default to 'f0','f1',... unless a RowTypeInfo with custom names was constructed. Expressions with invalid characters like spaces or hyphens fail the pattern.","commonSituations":"Developer uses a hyphenated or space-containing field name, or passes an empty string. Also occurs when a Row has custom field names set via RowTypeInfo(types, names) but the key references a name that doesn't match the regex (e.g. a name with a dot). Confusingly the error message says 'tuple' not 'Row', which can mislead.","solutions":["Use a valid Row field expression: integer index ('0'), default name ('f0'), custom name (valid identifier), or '*'.","Ensure custom Row field names are valid identifiers matching [\\p{L}_$][\\p{L}\\p{Digit}_$]*.","For nested Row/POJO fields inside a Row, use dot-separated expressions."],"exampleFix":"// before\nrowType.getFlatFields(\"my-field\");\n// after\nrowType.getFlatFields(\"myField\");","handlingStrategy":"validation","validationCode":"private static final Pattern ROW_FIELD =\n    Pattern.compile(\"([0-9]+|[\\\\p{L}_$][\\\\p{L}\\\\p{Digit}_$]*)(\\\\\\.(.+))?\");\n\nvoid validateRowFieldExpr(String expr) {\n    if (expr == null || !ROW_FIELD.matcher(expr).matches()) {\n        throw new IllegalArgumentException(\n            \"Invalid Row field expression: \" + expr);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use valid identifiers or integer indices for Row fields.","Remember the error message says 'tuple' but applies to Row — check the type if confused."],"tags":["row","field-reference","type-system","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}