{"record":{"id":"a2588df37446f332","repo":"apache/flink","slug":"nested-field-expression-not-possible-on-atomi-a2588d","errorCode":null,"errorMessage":"Nested field expression \"{}\" not possible on atomic type {}.","messagePattern":"Nested field expression \"(.+?)\" not possible on atomic type (.+?)\\.","errorType":"exception","errorClass":"InvalidFieldReferenceException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java","lineNumber":159,"sourceCode":"            for (int i = 0; i < fieldIndex; i++) {\n                offset += this.getTypeAt(i).getTotalFields();\n            }\n\n            String tail = matcher.group(3);\n\n            if (tail == null) {\n                // expression hasn't nested field\n                if (fieldType instanceof CompositeType) {\n                    ((CompositeType) fieldType).getFlatFields(\"*\", offset, result);\n                } else {\n                    result.add(new FlatFieldDescriptor(offset, fieldType));\n                }\n            } else {\n                // expression has nested field\n                if (fieldType instanceof CompositeType) {\n                    ((CompositeType) fieldType).getFlatFields(tail, offset, result);\n                } else {\n                    throw new InvalidFieldReferenceException(\n                            \"Nested field expression \\\"\"\n                                    + tail\n                                    + \"\\\" not possible on atomic type \"\n                                    + fieldType\n                                    + \".\");\n                }\n            }\n        }\n    }\n\n    @Override\n    public <X> TypeInformation<X> getTypeAt(String fieldExpression) {\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.\");","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java#L141-L177","documentation":"Thrown by RowTypeInfo.getFlatFields when a nested field expression (e.g. \"0.sub\" or \"myField.sub\") references a Row field whose TypeInformation is atomic (not a CompositeType). You cannot drill into a scalar with a dot-separated tail. This is an InvalidFieldReferenceException.","triggerScenarios":"Calling rowType.getFlatFields(\"f1.length\") where field f1 is a String, or keyBy(\"0.value\") where field 0 is an Integer. The tail (matcher.group(3)) is non-null but fieldType is not a CompositeType.","commonSituations":"Developer assumes a Row field holds a nested POJO/Tuple/Row but it resolves to a basic type. Common when working with schema-evolved Rows or when the nested type is not Flink-POJO-compliant.","solutions":["Remove the '.tail' — reference the atomic field directly by index or name.","If nesting is required, confirm the field's TypeInformation is a CompositeType via rowType.getTypeAt(index)."],"exampleFix":"// before\nrowType.getFlatFields(\"f0.inner\"); // f0 is a String\n// after\nrowType.getFlatFields(\"f0\");","handlingStrategy":"type-guard","validationCode":"TypeInformation<?> ft = rowType.getTypeAt(fieldIndex);\nif (tail != null && !(ft instanceof CompositeType)) {\n    throw new IllegalArgumentException(\n        \"Cannot nest into atomic \" + ft);\n}","typeGuard":"boolean canNestInto(RowTypeInfo type, int index) {\n    return type.getTypeAt(index) instanceof CompositeType;\n}","tryCatchPattern":null,"preventionTips":["Check if a Row field is a CompositeType before using nested expressions."],"tags":["row","nested-field","atomic-type","type-system","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}