{"record":{"id":"881a1182c6dd86df","repo":"apache/maven","slug":"the-token-s-at-position-d-refers-to-a-java-u","errorCode":null,"errorMessage":"The token '%s' at position '%d' refers to a java.util.Map, but the value seems is an instance of '%s'","messagePattern":"The token '(.+?)' at position '(.+?)' refers to a java\\.util\\.Map, but the value seems is an instance of '(.+?)'","errorType":"exception","errorClass":"IntrospectionException","httpStatus":null,"severity":"error","filePath":"compat/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/reflection/ReflectionValueExtractor.java","lineNumber":242,"sourceCode":"    }\n\n    private static Object getMappedValue(\n            final String expression, final int from, final int to, final Object value, final String key)\n            throws IntrospectionException {\n        if (value == null || key == null) {\n            return null;\n        }\n\n        if (value instanceof Map map) {\n            return map.get(key);\n        }\n\n        final String message = String.format(\n                \"The token '%s' at position '%d' refers to a java.util.Map, but the value \"\n                        + \"seems is an instance of '%s'\",\n                expression.subSequence(from, to), from, value.getClass());\n\n        throw new IntrospectionException(message);\n    }\n\n    private static Object getIndexedValue(\n            final String expression, final int from, final int to, final Object value, final String indexStr)\n            throws IntrospectionException {\n        try {\n            int index = Integer.parseInt(indexStr);\n\n            if (value.getClass().isArray()) {\n                return Array.get(value, index);\n            }\n\n            if (value instanceof List list) {\n                return list.get(index);\n            }\n        } catch (NumberFormatException | IndexOutOfBoundsException e) {\n            return null;\n        }","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/reflection/ReflectionValueExtractor.java#L224-L260","documentation":"ReflectionValueExtractor evaluates POM expressions like ${project.properties.x} by walking object graphs. When a dotted token is dereferenced as a map key against an object that is not a java.util.Map, evaluation aborts with IntrospectionException naming the token, its position in the expression, and the actual class found.","triggerScenarios":"An expression in a POM or plugin configuration whose intermediate value is a bean but is dereferenced with .key map syntax, e.g. ${project.someBean.someKey} where someBean is not a Map.","commonSituations":"Expressions written for old POM fields whose type changed; typos after model refactors; plugins interpolating against custom objects with map-style paths.","solutions":["Fix the expression path to match the real structure: use property names on beans, map keys only on Map-valued fields","Reserve dotted-key lookups for genuine Map values such as ${project.properties.someKey}","Search the POM and plugin configuration for the exact token named in the message","Prefer explicit <properties> entries for values you interpolate"],"exampleFix":"<!-- before: dotted-key lookup onto a non-Map value -->\n<version>${project.dependencyManagement.someKey}</version>\n\n<!-- after: use real map-valued entries for key lookups -->\n<version>${project.properties.someKey}</version>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static boolean isMapPath(Object node, String key) {\n    return node instanceof Map<?, ?> m && m.containsKey(key);\n}","tryCatchPattern":"try {\n    Object v = ReflectionValueExtractor.evaluate(expr, model);\n} catch (IntrospectionException e) {\n    // e.getMessage() names the token, position, and actual class: treat as config bug\n    log.warn(\"Unusable POM expression {}: {}\", expr, e.getMessage());\n    return defaultValue; // or rethrow for user-facing validation\n}","preventionTips":["Run mvn help:effective-pom after touching interpolated expressions","Use dotted-key lookups only against Map-valued fields such as project.properties","Grep poms and plugin configs for expressions before renaming model fields"],"tags":["maven","interpolation","reflection","pom-expression"],"backgroundTag":"expression-interpolation-failure","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}