quarkusio/quarkus · error · IllegalArgumentException

Unable to resolve Map parameter types for

Error message

Unable to resolve Map parameter types for 

What it means

When generating code to read a mandatory config property whose declared return type is a Map, the extension requires the Map to be a parameterized type so key/value converters can be resolved. A raw Map (no generic arguments) triggers IllegalArgumentException 'Unable to resolve Map parameter types for <propertyName>'.

Source

Thrown at extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigurationPropertiesUtil.java:67

     * Generates code that uses Config#getValue for simple objects, or SmallRyeConfig#getValues if it is a Collection
     * type.
     *
     * @param propertyName Property name that needs to be fetched
     * @param resultType Type to which the property value needs to be converted to
     * @param declaringClass Config class where the type was encountered
     * @param bc Where the bytecode will be generated
     * @param config Reference to the MP config object
     */
    static Expr createReadMandatoryValueAndConvertIfNeeded(
            String propertyName,
            Type resultType,
            DotName declaringClass,
            BlockCreator bc,
            Expr config) {

        if (isMap(resultType)) {
            if (resultType.kind() != Kind.PARAMETERIZED_TYPE) {
                throw new IllegalArgumentException("Unable to resolve Map parameter types for " + propertyName);
            }

            ParameterizedType parameterizedType = resultType.asParameterizedType();
            String keyType = parameterizedType.arguments().get(0).name().toString();
            String valueType = parameterizedType.arguments().get(1).name().toString();

            // Only support Map#value with Converter
            // We don't have a way to validate, so it will fail at runtime (with a proper error message from SR Config)
            return bc.invokeInterface(
                    CONFIG_GET_VALUES_MAP,
                    config,
                    Const.of(propertyName),
                    Const.of(Jandex2Gizmo.classDescOf(DotName.createSimple(keyType))),
                    Const.of(Jandex2Gizmo.classDescOf(DotName.createSimple(valueType))));
        } else if (isCollection(resultType)) {
            Class<?> factoryToUse = DotNames.SET.equals(resultType.name()) ? HashSetFactory.class : ArrayListFactory.class;
            return bc.invokeInterface(
                    CONFIG_GET_VALUES_COLLECTION,

View on GitHub (pinned to e1c734241f)

Solutions

  1. Parameterize the Map, e.g. Map<String, String> or Map<String, MyType>, on the getter/field.
  2. If truly untyped, use Map<String, String> and parse values yourself.
  3. For interface-based config, declare the generic parameters on the method return type.

Example fix

// before
Map getSettings();

// after
Map<String, String> getSettings();
Defensive patterns

Strategy: type-guard

Type guard

// Java: compiler enforces generics; avoid raw types so this fails at compile time
static boolean isParameterizedMap(java.lang.reflect.Type t) {
  return t instanceof java.lang.reflect.ParameterizedType pt
      && pt.getRawType() == Map.class;
}

Prevention

When it happens

Trigger: A @ConfigurationProperties getter/method (mandatory-value path, createReadMandatoryValueAndConvertIfNeeded) declares a return type of raw Map or Map without type arguments (Kind != PARAMETERIZED_TYPE) for some property name.

Common situations: Returning raw Map for convenience; assigning a raw Map from legacy code; generic type erasure leaving the declared type unparameterized in an interface config property.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/2c429404053adf61. Report an issue: GitHub.