quarkusio/quarkus · error · UnsupportedOperationException

Unsupported value:

Error message

Unsupported value: 

What it means

AnnotationLiteralProcessor.loadValue() converts a Jandex annotation member value into a runtime expression that builds an AnnotationLiteral. Its switch covers primitive types, String, Class, enum, and annotation component kinds; if the Jandex AnnotationValue has a kind outside that set, it throws UnsupportedOperationException. Reaching this indicates an unexpected/unsupported annotation member value kind in the CDI processing pipeline.

Source

Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java:324

                            yield bc.getStaticField(FieldDescs.ANNOTATION_LITERALS_EMPTY_DOUBLE_ARRAY);
                        } else if (ConstantDescs.CD_char.equals(componentType)) {
                            yield bc.getStaticField(FieldDescs.ANNOTATION_LITERALS_EMPTY_CHAR_ARRAY);
                        } else if (ConstantDescs.CD_String.equals(componentType)) {
                            yield bc.getStaticField(FieldDescs.ANNOTATION_LITERALS_EMPTY_STRING_ARRAY);
                        } else if (ConstantDescs.CD_Class.equals(componentType)) {
                            yield bc.getStaticField(FieldDescs.ANNOTATION_LITERALS_EMPTY_CLASS_ARRAY);
                        } else {
                            yield bc.newEmptyArray(componentType, Const.of(0));
                        }
                    }
                    default -> {
                        // at this point, the only possible component kind is "array"
                        throw new UnsupportedOperationException("Array component kind is " + componentKind
                                + ", this should never happen");
                    }
                };
            }
            default -> throw new UnsupportedOperationException("Unsupported value: " + annotationMemberValue);
        };
    }

    private static ClassDesc componentTypeOf(MethodInfo annotationMember) {
        assert annotationMember.returnType().kind() == Type.Kind.ARRAY;
        return classDescOf(annotationMember.returnType().asArrayType().componentType());
    }

    // ---

    private static String componentType(MethodInfo method) {
        return componentTypeName(method).toString();
    }

    private static DotName componentTypeName(MethodInfo method) {
        ArrayType arrayType = method.returnType().asArrayType();
        return arrayType.constituent().name();
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the annotation member at fault and change its type to a CDI-safe type (primitive, String, Class, enum, nested annotation, or array thereof)
  2. Annotate non-binding complex members with @Nonbinding if the annotation is an interceptor binding/qualifier so the value is never rendered
  3. Upgrade Quarkus/Arc — new value kinds are sometimes added in newer versions
  4. If the annotation comes from a third-party library, avoid using it where Arc must synthesize a literal, or wrap/remove the member

Example fix

// before
@interface MyBinding { ThreadLocal<String> weird(); }
// after
@interface MyBinding { @Nonbinding String value() default ""; }
Defensive patterns

Strategy: validation

Validate before calling

for (AnnotationInstance ann : annotations) {
    for (AnnotationValue v : ann.values()) {
        if (!isSupportedKind(v.kind())) throw new IllegalStateException("Unsupported member: " + v.name());
    }
}
static boolean isSupportedKind(AnnotationValue.Kind k) {
    return switch (k) {
        case BOOLEAN, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, CHAR, STRING, CLASS, ENUM, NESTED, ARRAY -> true;
        default -> false;
    };
}

Type guard

static boolean isSupportedAnnotationValue(AnnotationValue v) {
    return v != null && isSupportedKind(v.kind());
}

Try / catch

try { processor.loadValue(member, value); }
catch (UnsupportedOperationException e) { throw new DeploymentException("Bad annotation member " + member, e); }

Prevention

When it happens

Trigger: An annotation used in bean metadata has a member whose Jandex value kind is not one of the handled kinds (e.g. nested/odd array component kind or a non-standard value type) when Arc builds annotation literal creation code during deployment.

Common situations: Custom annotations with unusual member types used on beans/interceptors/qualifiers; Jandex/JBoss-Classfile version changes introducing new value kinds; hand-written bytecode or bytecode transformations producing exotic annotation values.

Related errors


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