quarkusio/quarkus · error · IllegalStateException

Unhandled type: ${type}

Error message

Unhandled type: ${type}

What it means

When a single-expression ClientHeaderParam value resolves to one header-filler method, the generator handles only String[] (repacked to a List) and String (wrapped in a List). Any other resolved return type reaching this point fails the build with IllegalStateException. Normally unreachable because earlier validation rejects non-String/String[] types.

Source

Thrown at extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java:997

                }
            }).collect(Collectors.toList());

            AssignableResultHandle headerList = fillHeader.createVariable(List.class);
            fillHeader.assign(headerList, fillHeader.loadNull());
            if (headerFillerInfos.size() == 1) {
                HeaderFillerInfo headerFillerInfo = headerFillerInfos.get(0);
                ResultHandle headerFillerResult = headerFillerInfo.getResultHandleSupplier().get();
                BytecodeCreator notNullBranchTrue = fillHeader.ifNotNull(headerFillerResult).trueBranch();
                Type headerFillerMethodReturnType = headerFillerInfo.getValueType();
                if (isStringArray(headerFillerMethodReturnType)) {
                    // repack array to list
                    ResultHandle asList = notNullBranchTrue.invokeStaticMethod(ARRAYS_AS_LIST, headerFillerResult);
                    notNullBranchTrue.assign(headerList, asList);
                } else if (isString(headerFillerMethodReturnType)) {
                    notNullBranchTrue.assign(headerList, Gizmo.newArrayList(notNullBranchTrue, 1));
                    notNullBranchTrue.invokeInterfaceMethod(LIST_ADD_METHOD, headerList, headerFillerResult);
                } else {
                    throw new IllegalStateException("Unhandled type: " + headerFillerMethodReturnType);
                }
            } else {
                ResultHandle nonNullValuesList = Gizmo.newArrayList(fillHeader, headerFillerInfos.size());
                for (HeaderFillerInfo headerFillerInfo : headerFillerInfos) {
                    if (!isString(headerFillerInfo.getValueType())) {
                        throw new IllegalStateException("Unhandled type: " + headerFillerInfo.getValueType());
                    }
                    ResultHandle value = headerFillerInfo.getResultHandleSupplier().get();
                    BytecodeCreator notNullBranch = fillHeader.ifNotNull(value).trueBranch();
                    notNullBranch.invokeInterfaceMethod(LIST_ADD_METHOD, nonNullValuesList, value);
                }
                ResultHandle sb = fillHeader.newInstance(MethodDescriptor.ofConstructor(StringBuilder.class));
                ForEachLoop loop = fillHeader.forEach(nonNullValuesList);
                BytecodeCreator block = loop.block();
                block.invokeVirtualMethod(STRING_BUILDER_APPEND, sb, loop.element());
                ResultHandle stringValue = Gizmo.toString(fillHeader, sb);

                ResultHandle stringValueLength = fillHeader.invokeVirtualMethod(STRING_LENGTH, stringValue);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the referenced method's return type to String or String[]
  2. Clean rebuild to rule out stale indexing
  3. Report a Quarkus issue if the type is genuinely String/String[] and still fails
Defensive patterns

Strategy: validation

Validate before calling

Method m = MyClient.class.getDeclaredMethod("computeHeader");
if (!(m.getReturnType() == String.class || m.getReturnType() == String[].class)) {
    throw new IllegalStateException("Header provider must return String or String[]");
}

Type guard

static boolean isStringOrStringArray(Class<?> t) {
    return t == String.class || t == String[].class;
}

Prevention

When it happens

Trigger: A single-node header expression whose filler method return type is neither String nor String[] at bytecode-generation time — indicates validation and generation saw different types, i.e. an internal bug or exotic type representation.

Common situations: Only expected with framework bugs, mismatched Quarkus artifacts, or unusual type signatures the Jandex type checks classify differently.

Related errors


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