quarkusio/quarkus · error · ErrorDataDecoderException

Error decoding multipart field charset/length (wrapped IOExc

Error message

Error decoding multipart field charset/length (wrapped IOException)

What it means

After resolving the field name and optional size, the decoder calls factory.createAttribute(...); failures — NullPointerException from a missing name attribute, IllegalArgumentException from an invalid name/size, or IOException reading the value — are wrapped in ErrorDataDecoderException.

Source

Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartResponseDecoder.java:574

                    long size;
                    try {
                        size = lengthAttribute != null ? Long.parseLong(lengthAttribute
                                .getValue()) : 0L;
                    } catch (IOException e) {
                        throw new ErrorDataDecoderException(e);
                    } catch (NumberFormatException ignored) {
                        size = 0;
                    }
                    try {
                        if (size > 0) {
                            currentAttribute = factory.createAttribute(response,
                                    cleanString(nameAttribute.getValue()), size);
                        } else {
                            currentAttribute = factory.createAttribute(response,
                                    cleanString(nameAttribute.getValue()));
                        }
                    } catch (NullPointerException | IllegalArgumentException | IOException e) {
                        throw new ErrorDataDecoderException(e);
                    }
                    if (localCharset != null) {
                        currentAttribute.setCharset(localCharset);
                    }
                }
                // load data
                if (!loadDataMultipartOptimized(undecodedChunk, multipartDataBoundary, currentAttribute)) {
                    // Delimiter is not found. Need more chunks.
                    return null;
                }
                Attribute finalAttribute = currentAttribute;
                currentAttribute = null;
                currentFieldAttributes = null;
                // ready to load the next one
                currentStatus = MultiPartStatus.HEADERDELIMITER;
                return finalAttribute;
            }
            case FILEUPLOAD: {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure every part's Content-Disposition includes a name= parameter
  2. Check any custom DefaultHttpDataFactory configuration (max sizes) used by the client
  3. Fix sender/proxy corruption of part headers
  4. Catch ErrorDataDecoderException and log the wrapped cause to identify NPE vs IAE vs IOException

Example fix

// before (part header)
Content-Disposition: form-data
// after
Content-Disposition: form-data; name="field1"
Defensive patterns

Strategy: validation

Validate before calling

if (!contentDisposition.contains("name=")) {
    throw new IllegalArgumentException("Part missing name parameter: " + contentDisposition);
}

Try / catch

try { decoder.offer(chunk); } catch (ErrorDataDecoderException e) { if (e.getCause() instanceof NullPointerException) { log.error("Part without name attribute"); } }

Prevention

When it happens

Trigger: A part's Content-Disposition lacks a name= parameter (nameAttribute null → cleanString(null) NPE), or the name/size combination is rejected by the attribute factory, or createAttribute/getValue throws IOException.

Common situations: Server emitting parts without name in Content-Disposition; custom HttpDataFactory rejecting oversized fields; corrupted part headers from proxies.

Related errors


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