quarkusio/quarkus · error · ErrorDataDecoderException

Error decoding multipart field attribute (wrapped NullPointe

Error message

Error decoding multipart field attribute (wrapped NullPointerException/IllegalArgumentException/IOException)

What it means

When building the Attribute for a multipart field, the decoder reads the Content-Length part header; if reading that attribute's value raises IOException, it is wrapped into ErrorDataDecoderException. (NumberFormatException is deliberately swallowed and treated as size 0.)

Source

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

                Charset localCharset = null;
                Attribute charsetAttribute = currentFieldAttributes.get(HttpHeaderValues.CHARSET);
                if (charsetAttribute != null) {
                    try {
                        localCharset = Charset.forName(charsetAttribute.getValue());
                    } catch (IOException | UnsupportedCharsetException e) {
                        throw new ErrorDataDecoderException(e);
                    }
                }
                Attribute nameAttribute = currentFieldAttributes.get(HttpHeaderValues.NAME);
                if (currentAttribute == null) {
                    Attribute lengthAttribute = currentFieldAttributes
                            .get(HttpHeaderNames.CONTENT_LENGTH);
                    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);
                    }
                }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the sender so part headers are well-formed and complete
  2. Remove spurious Content-Length headers from individual parts (size is usually not needed)
  3. Ensure the connection isn't truncated mid-headers (check proxy timeouts)
  4. Catch ErrorDataDecoderException and inspect the wrapped cause

Example fix

// before (part)
Content-Disposition: form-data; name="f"
Content-Length: (unparseable/garbled value)
// after
Content-Disposition: form-data; name="f"
Defensive patterns

Strategy: try-catch

Try / catch

try { decoder.offer(chunk); } catch (ErrorDataDecoderException e) { if (e.getCause() instanceof IOException) { log.error("I/O reading multipart part headers", e); } }

Prevention

When it happens

Trigger: A part declares Content-Length: N (N > 0) and lengthAttribute.getValue() throws IOException while reading the header value from the underlying buffer/attribute.

Common situations: Malformed or truncated part headers from a broken server/proxy; I/O failure while lazily reading the attribute value.

Related errors


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