quarkusio/quarkus · error · ErrorDataDecoderException
TransferEncoding Unknown: " + code
Error message
TransferEncoding Unknown: " + code
What it means
The decoder only supports 7bit, 8bit, and binary Content-Transfer-Encoding values for file uploads. Any other value (e.g. base64, quoted-printable) triggers ErrorDataDecoderException 'TransferEncoding Unknown'. Quarkus' multipart response decoder does not transcode content, so unsupported encodings are rejected outright.
Source
Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartResponseDecoder.java:890
// Default
TransferEncodingMechanism mechanism = TransferEncodingMechanism.BIT7;
if (encoding != null) {
String code;
try {
code = encoding.getValue().toLowerCase();
} catch (IOException e) {
throw new ErrorDataDecoderException(e);
}
if (code.equals(TransferEncodingMechanism.BIT7.value())) {
localCharset = CharsetUtil.US_ASCII;
} else if (code.equals(TransferEncodingMechanism.BIT8.value())) {
localCharset = CharsetUtil.ISO_8859_1;
mechanism = TransferEncodingMechanism.BIT8;
} else if (code.equals(TransferEncodingMechanism.BINARY.value())) {
// no real charset, so let the default
mechanism = TransferEncodingMechanism.BINARY;
} else {
throw new ErrorDataDecoderException("TransferEncoding Unknown: " + code);
}
}
Attribute charsetAttribute = currentFieldAttributes.get(HttpHeaderValues.CHARSET);
if (charsetAttribute != null) {
try {
localCharset = Charset.forName(charsetAttribute.getValue());
} catch (IOException | UnsupportedCharsetException e) {
throw new ErrorDataDecoderException(e);
}
}
if (currentFileUpload == null) {
Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME);
Attribute nameAttribute = currentFieldAttributes.get(HttpHeaderValues.NAME);
Attribute contentTypeAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_TYPE);
Attribute lengthAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_LENGTH);
long size;
try {
size = lengthAttribute != null ? Long.parseLong(lengthAttribute.getValue()) : 0L;View on GitHub (pinned to e1c734241f)
Solutions
- Change the server to send parts with Content-Transfer-Encoding: binary (or omit the header, defaulting to 7bit) and send raw bytes.
- If the server must send base64, decode the body yourself instead of relying on this decoder.
- Remove base64/quoted-printable transformation from the server's multipart writer.
- Use plain multipart/form-data with raw octet streams, which is the norm over HTTP.
Example fix
// before Content-Transfer-Encoding: base64 // after Content-Transfer-Encoding: binary
Defensive patterns
Strategy: validation
Validate before calling
// Only allow supported transfer encodings in emitted parts
Set<String> OK = Set.of("7bit", "8bit", "binary");
if (cte != null && !OK.contains(cte.toLowerCase())) {
throw new IllegalStateException("Unsupported Content-Transfer-Encoding for HTTP multipart: " + cte);
} Type guard
static boolean isSupportedTransferEncoding(String cte) {
return cte == null || Set.of("7bit", "8bit", "binary").contains(cte.toLowerCase());
} Try / catch
try {
result = decodeMultipart(...);
} catch (ErrorDataDecoderException e) {
if (String.valueOf(e.getMessage()).startsWith("TransferEncoding Unknown")) {
throw new UnsupportedEncodingException("Server used base64/quoted-printable; request raw binary parts", e);
}
throw e;
} Prevention
- Never apply MIME base64/quoted-printable encodings to HTTP multipart parts.
- Send raw bytes with Content-Transfer-Encoding: binary or omit the header.
- Audit any mail-inspired multipart writers on the server side.
- Integration-test large binary uploads end to end.
When it happens
Trigger: A file-upload part declares Content-Transfer-Encoding with a value other than '7bit', '8bit', or 'binary' (after lowercasing), such as 'base64' or 'quoted-printable'.
Common situations: Servers that MIME-encode parts (base64) like email attachments; proxies adding transfer encodings; misconfigured exporters that copy SMTP-style headers into HTTP multipart.
Related errors
- Error decoding transfer-encoding value (wrapped IOException)
- setting content of MultiByteHttpData is not supported
- adding content to MultiByteHttpData is not supported
- getting all the contents of a MultiByteHttpData is not suppo
- MultiByteHttpData invoked on an invalid context :
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f0aa3a2b081b2130.
Report an issue: GitHub.