{"record":{"id":"a837d126b9be8d85","repo":"apache/flink","slug":"wildcard-expressions-are-not-allowed-here-a837d1","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/TupleTypeInfoBase.java","lineNumber":191,"sourceCode":"                    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\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 \\\"\"","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfoBase.java#L173-L209","documentation":"Thrown by TupleTypeInfoBase.getTypeAt(String) when a wildcard character ('*' or '_') is used as a field expression. Wildcards are only supported by getFlatFields, not by getTypeAt, which expects a concrete field position like 'f0' or '1'. The method validates the expression against PATTERN_NESTED_FIELDS ((f?)([0-9]+)) and explicitly rejects the SELECT_ALL_CHAR before falling through to the generic invalid-format error.","triggerScenarios":"Calling tupleType.getTypeAt(\"*\") or tupleType.getTypeAt(\"_\") on a TupleTypeInfoBase instance (e.g. TupleTypeInfo for Tuple2). Also triggered indirectly when a join/group/select key selector that uses wildcard notation is resolved through getTypeAt instead of getFlatFields.","commonSituations":"A developer confuses the field-selection API for keys (which supports '*' for 'all fields') with the type-lookup API. Happens when programmatically building dataflows and passing a wildcard key string where a specific tuple field index is required.","solutions":["Replace the wildcard with a concrete field index, e.g. getTypeAt(\"f0\") or getTypeAt(\"0\").","If you need all fields, use getFlatFields(fieldExpression, offset, result) instead of getTypeAt.","Review the calling code to ensure you are not forwarding a user-facing '*' selector into a type-resolution path."],"exampleFix":"// before\ntupleType.getTypeAt(\"*\");\n// after\ntupleType.getTypeAt(\"f0\");","handlingStrategy":"validation","validationCode":"if (\"*\".equals(fieldExpr) || \"_\".equals(fieldExpr)) {\n    throw new IllegalArgumentException(\"Wildcard not supported by getTypeAt; use getFlatFields instead.\");\n}\ntupleType.getTypeAt(fieldExpr);","typeGuard":"static boolean isValidTupleFieldExpression(String expr) {\n    return expr != null && !\"*\".equals(expr) && !\"_\".equals(expr)\n        && expr.matches(\"(f?)([0-9]+)(\\\\.(.+))?\");\n}","tryCatchPattern":null,"preventionTips":["Never pass wildcard characters to getTypeAt; it only accepts concrete field indices.","Use getFlatFields if wildcard selection is needed.","Validate field expressions against the regex (f?)([0-9]+) before calling getTypeAt."],"tags":["type-extraction","tuple","field-expression","wildcard"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}