quarkusio/quarkus · error · IllegalArgumentException

Unknown parameter ${entry.getKey()}: ${entry.getValue()}

Error message

Unknown parameter ${entry.getKey()}: ${entry.getValue()}

What it means

ContextConfigurator.creator() builds a Map of parameters to pass to a ContextCreator. Only String, enum, Class, and Boolean values can be encoded as compile-time constants in generated bytecode; any other parameter type is rejected with this IllegalArgumentException at build time.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ContextConfigurator.java:168

            LocalVar params = bc.localVar("params", bc.new_(HashMap.class));
            bc.withMap(params).put(Const.of(ContextCreator.KEY_CURRENT_CONTEXT_FACTORY), cg.currentContextFactory());
            for (Entry<String, Object> entry : this.params.entrySet()) {
                Expr value;
                if (entry.getValue() instanceof String s) {
                    value = Const.of(s);
                } else if (entry.getValue() instanceof Integer i) {
                    value = Const.of(i);
                } else if (entry.getValue() instanceof Long l) {
                    value = Const.of(l);
                } else if (entry.getValue() instanceof Double d) {
                    value = Const.of(d);
                } else if (entry.getValue() instanceof Class<?> c) {
                    value = Const.of(c);
                } else if (entry.getValue() instanceof Boolean b) {
                    value = Const.of(b);
                } else {
                    throw new IllegalArgumentException("Unknown parameter " + entry.getKey() + ": " + entry.getValue());
                }
                bc.withMap(params).put(Const.of(entry.getKey()), value);
            }
            Expr creator = bc.new_(creatorClazz);
            return bc.invokeInterface(
                    MethodDesc.of(ContextCreator.class, "create", InjectableContext.class, Map.class),
                    creator, params);
        });
    }

    public ContextConfigurator creator(Function<CreateGeneration, Expr> creator) {
        this.creator = creator;
        return this;
    }

    public void done() {
        if (consumed.compareAndSet(false, true)) {
            Objects.requireNonNull(creator);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Convert numeric or other primitives to String or Boolean parameters
  2. Pass a Class or enum constant instead of an instance
  3. Handle complex state inside the ContextCreator itself (read config statically) rather than via parameters
  4. Check the Map contents against the supported types: String, Class, enum, Boolean

Example fix

// before
creator(MyCreator.class, Map.of("timeout", 30))
// after
creator(MyCreator.class, Map.of("timeout", "30"))
Defensive patterns

Strategy: validation

Validate before calling

static void validateCreatorParams(Map<String, Object> params) {
  for (var e : params.entrySet()) {
    Object v = e.getValue();
    if (!(v instanceof String || v instanceof Class || v instanceof Boolean
        || (v != null && v.getClass().isEnum())))
      throw new IllegalArgumentException("Unsupported param " + e.getKey() + " of " + v.getClass());
  }
}

Type guard

static boolean isSupportedParamValue(Object v) {
  return v instanceof String || v instanceof Class || v instanceof Boolean
      || (v != null && v.getClass().isEnum());
}

Prevention

When it happens

Trigger: Calling creator(clazz, Map.of("key", someObject)) with a value that is not a String, Class, enum constant, or Boolean (e.g. Integer, List, custom POJO, null).

Common situations: Passing an Integer or int autoboxed constant; passing a config object; passing a Map.copyOf map containing mixed types like Integer values.

Related errors


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