{"record":{"id":"e8a51290d80a9f27","repo":"apache/flink","slug":"wildcard-expressions-are-not-allowed-here","errorCode":null,"errorMessage":"Wildcard expressions are not allowed here.","messagePattern":"Wildcard expressions are not allowed here\\.","errorType":"exception","errorClass":"InvalidFieldReferenceException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/PojoTypeInfo.java","lineNumber":248,"sourceCode":"                        \"Nested field expression \\\"\"\n                                + tail\n                                + \"\\\" not possible on atomic type \"\n                                + 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        }","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/PojoTypeInfo.java#L230-L266","documentation":"Thrown by PojoTypeInfo.getTypeAt(String) when the fieldExpression is a wildcard character ('*' or '_'). getTypeAt returns the TypeInformation of exactly one field, so a wildcard that selects all fields is semantically invalid here. This is an InvalidFieldReferenceException.","triggerScenarios":"Calling pojoTypeInfo.getTypeAt(\"*\") or pojoTypeInfo.getTypeAt(\"_\"). ExpressionKeys calls getTypeAt internally at Keys.java:338 only after stripping wildcards, so end users rarely hit this directly — it indicates direct API misuse or a custom wrapper that forwards wildcard expressions.","commonSituations":"Programmatic code that passes the same expression list to both getFlatFields (which accepts '*') and getTypeAt (which does not). Rarely seen in typical DataStream/DataSet programs.","solutions":["Do not pass '*' or '_' to getTypeAt — use getFlatFields instead if you need all fields.","If calling getTypeAt programmatically, filter out wildcard expressions before the call."],"exampleFix":"// before\npojoTypeInfo.getTypeAt(\"*\");\n// after\npojoTypeInfo.getFlatFields(\"*\");","handlingStrategy":"validation","validationCode":"void safeGetTypeAt(CompositeType<?> type, String expr) {\n    if (\"*\".equals(expr) || \"_\".equals(expr)) {\n        throw new IllegalArgumentException(\n            \"Use getFlatFields for wildcard expressions, not getTypeAt\");\n    }\n    type.getTypeAt(expr);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass '*' or '_' to getTypeAt.","Route wildcard expressions to getFlatFields only."],"tags":["pojo","wildcard","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"}