quarkusio/quarkus · error · IllegalArgumentException

Array of unsupported type: " + typeStr + " on " + errorLocat

Error message

Array of unsupported type: " + typeStr + " on " + errorLocation

What it means

When encoding a multipart form field, Quarkus supports byte[] (via Buffer) but not arrays of other types. If the field's type string denotes any array other than byte[] (not "[B"), the code generator cannot serialize it and throws.

Source

Thrown at extensions/resteasy-reactive/rest-client-jaxrs/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java:2340

            // file is sent as file :)
            ResultHandle filePath = bytecodeCreator.invokeVirtualMethod(
                    MethodDescriptor.ofMethod(File.class, "toPath", Path.class), fieldValue);
            addFile(bytecodeCreator, multipartForm, formParamName, mimeType, partFilename, filePath);
        } else if (typeStr.equals(Path.class.getName())) {
            // and so is path
            addFile(bytecodeCreator, multipartForm, formParamName, mimeType, partFilename, fieldValue);
        } else if (typeStr.equals(FileUpload.class.getName())) {
            addFileUpload(fieldValue, multipartForm, methodCreator);
        } else if (typeStr.equals(InputStream.class.getName())) {
            // and so is path
            addInputStream(bytecodeCreator, multipartForm, formParamName, mimeType, partFilename, fieldValue, typeStr);
        } else if (typeStr.equals(Buffer.class.getName())) {
            // and buffer
            addBuffer(bytecodeCreator, multipartForm, formParamName, mimeType, partFilename, fieldValue, errorLocation);
        } else if (typeStr.startsWith("[")) {
            // byte[] can be sent as file too
            if (!typeStr.equals("[B")) {
                throw new IllegalArgumentException("Array of unsupported type: " + typeStr
                        + " on " + errorLocation);
            }
            ResultHandle buffer = bytecodeCreator.invokeStaticInterfaceMethod(
                    MethodDescriptor.ofMethod(Buffer.class, "buffer", Buffer.class, byte[].class),
                    fieldValue);
            addBuffer(bytecodeCreator, multipartForm, formParamName, mimeType, partFilename, buffer, errorLocation);
        } else if (MULTI_BYTE_SIGNATURE.equals(parameterSignature)) {
            addMultiAsFile(bytecodeCreator, multipartForm, formParamName, mimeType, partFilename, fieldValue,
                    errorLocation);
        } else if (typeStr.equals(EntityPart.class.getName())) {
            bytecodeCreator.invokeStaticMethod(
                    MethodDescriptor.ofMethod(ClientSendRequestHandler.class, "addEntityPartToForm",
                            void.class, QuarkusMultipartForm.class, EntityPart.class),
                    multipartForm, fieldValue);
        } else if (mimeType != null) {
            if (partFilename != null) {
                log.warnf("Using the @PartFilename annotation is unsupported on the type '%s'. Problematic field is: '%s'",
                        mimeType, formParamName);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the field type to List<SupportedType> (e.g. List<String>, List<FileUpload>) which multipart supports as repeated parts
  2. Convert arrays to byte[] only if you truly want raw bytes, and use byte[] (mapped to io.vertx.core.buffer.Buffer)
  3. Serialize the array yourself to JSON/String and send as a single String part

Example fix

// before
@RestForm
String[] tags;
// after
@RestForm
List<String> tags;
Defensive patterns

Strategy: validation

Validate before calling

static void validateMultipartFields(Class<?> formBean) {
    for (var f : formBean.getDeclaredFields()) {
        if (f.getType().isArray() && f.getType() != byte[].class) {
            throw new IllegalArgumentException(
                "Multipart field " + f.getName() + " cannot be array " + f.getType() + "; use List<T> or byte[]");
        }
    }
}

Type guard

static boolean multipartSafe(Class<?> t) {
    if (t.isArray()) return t == byte[].class;
    return true; // further checks per supported types
}

Prevention

When it happens

Trigger: A @MultipartForm bean field (or bean param field) of type int[], String[], SomeObject[], etc., sent through a REST client multipart upload.

Common situations: Trying to upload multiple values as a primitive/object array in a multipart form; refactoring a JSON body DTO to be reused as a multipart form DTO.

Related errors


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