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
- Fix the sender so part headers are well-formed and complete
- Remove spurious Content-Length headers from individual parts (size is usually not needed)
- Ensure the connection isn't truncated mid-headers (check proxy timeouts)
- 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
- Avoid per-part Content-Length headers unless needed
- Monitor for truncated connections (proxy timeouts)
- Log raw part headers on decode failure
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
- Cannot create a Encoder if request is a TRACE
- Needs a boundary value
- No 'Content-Type' header present.
- Illegal charset in multipart response Content-Type (wrapped)
- Unable to parse multipart response - No delimiter specified
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/d77384fbb2db7a0e.
Report an issue: GitHub.