{"record":{"id":"57e64cf68f93e8c7","repo":"apache/flink","slug":"invalid-format-of-pojo-field-expression","errorCode":null,"errorMessage":"Invalid format of POJO field expression \"{}\".","messagePattern":"Invalid format of POJO field expression \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidFieldReferenceException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/PojoTypeInfo.java","lineNumber":251,"sourceCode":"                                + fieldType\n                                + \".\");\n            }\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    @PublicEvolving\n    public <X> TypeInformation<X> getTypeAt(String fieldExpression) {\n\n        Matcher matcher = PATTERN_NESTED_FIELDS.matcher(fieldExpression);\n        if (!matcher.matches()) {\n            if (fieldExpression.startsWith(ExpressionKeys.SELECT_ALL_CHAR)\n                    || fieldExpression.startsWith(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 POJO field expression \\\"\" + fieldExpression + \"\\\".\");\n            }\n        }\n\n        String field = matcher.group(1);\n        // get field\n        int fieldPos = -1;\n        TypeInformation<?> fieldType = null;\n        for (int i = 0; i < fields.length; i++) {\n            if (fields[i].getField().getName().equals(field)) {\n                fieldPos = i;\n                fieldType = fields[i].getTypeInformation();\n                break;\n            }\n        }\n        if (fieldPos == -1) {\n            throw new InvalidFieldReferenceException(\n                    \"Unable to find field \\\"\" + field + \"\\\" in type \" + this + \".\");","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/PojoTypeInfo.java#L233-L269","documentation":"Thrown by PojoTypeInfo.getTypeAt(String) when the fieldExpression does not match the POJO nested-field regex and is not a wildcard character. The expression is syntactically malformed for a POJO field reference. This is an InvalidFieldReferenceException.","triggerScenarios":"Calling pojoTypeInfo.getTypeAt(\"123\"), getTypeAt(\"\"), getTypeAt(\"field-name\"), or getTypeAt(\"a.\"). The PATTERN_NESTED_FIELDS matcher fails and the expression does not start with '*' or '_'.","commonSituations":"Direct programmatic use of getTypeAt with a non-identifier string, or passing a tuple-style key ('f0') to a POJO type's getTypeAt. Occasionally reached when ExpressionKeys strips a trailing wildcard and leaves an empty or malformed remainder.","solutions":["Use a valid POJO field-name identifier (letter/underscore/'$' start, alphanumeric/underscore/'$' body).","For nested access use dot-separated valid identifiers: \"outerField.innerField\"."],"exampleFix":"// before\npojoTypeInfo.getTypeAt(\"f0\"); // f0 is tuple syntax, not POJO\n// after\npojoTypeInfo.getTypeAt(\"fieldName\");","handlingStrategy":"validation","validationCode":"private static final Pattern POJO_NESTED =\n    Pattern.compile(\"([\\\\p{L}_$][\\\\p{L}\\\\p{Digit}_$]*)(\\\\\\.(.+))?\");\n\nvoid validateGetTypeAtExpr(String expr) {\n    if (!POJO_NESTED.matcher(expr).matches()) {\n        throw new IllegalArgumentException(\"Malformed field expression: \" + expr);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate field expressions against the POJO identifier regex before calling getTypeAt.","Avoid passing tuple-style 'f0' expressions to POJO types."],"tags":["pojo","field-reference","gettypeat","type-system","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}