{"record":{"id":"6056e20b1ffdc573","repo":"quarkusio/quarkus","slug":"error-decoding-multipart-charset-wrapped-ioexcept","errorCode":null,"errorMessage":"Error decoding multipart charset (wrapped IOException/UnsupportedCharsetException)","messagePattern":"Error decoding multipart charset \\(wrapped IOException/UnsupportedCharsetException\\)","errorType":"exception","errorClass":"ErrorDataDecoderException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartResponseDecoder.java","lineNumber":898,"sourceCode":"            }\n            if (code.equals(TransferEncodingMechanism.BIT7.value())) {\n                localCharset = CharsetUtil.US_ASCII;\n            } else if (code.equals(TransferEncodingMechanism.BIT8.value())) {\n                localCharset = CharsetUtil.ISO_8859_1;\n                mechanism = TransferEncodingMechanism.BIT8;\n            } else if (code.equals(TransferEncodingMechanism.BINARY.value())) {\n                // no real charset, so let the default\n                mechanism = TransferEncodingMechanism.BINARY;\n            } else {\n                throw new ErrorDataDecoderException(\"TransferEncoding Unknown: \" + code);\n            }\n        }\n        Attribute charsetAttribute = currentFieldAttributes.get(HttpHeaderValues.CHARSET);\n        if (charsetAttribute != null) {\n            try {\n                localCharset = Charset.forName(charsetAttribute.getValue());\n            } catch (IOException | UnsupportedCharsetException e) {\n                throw new ErrorDataDecoderException(e);\n            }\n        }\n        if (currentFileUpload == null) {\n            Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME);\n            Attribute nameAttribute = currentFieldAttributes.get(HttpHeaderValues.NAME);\n            Attribute contentTypeAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_TYPE);\n            Attribute lengthAttribute = currentFieldAttributes.get(HttpHeaderNames.CONTENT_LENGTH);\n            long size;\n            try {\n                size = lengthAttribute != null ? Long.parseLong(lengthAttribute.getValue()) : 0L;\n            } catch (IOException e) {\n                throw new ErrorDataDecoderException(e);\n            } catch (NumberFormatException ignored) {\n                size = 0;\n            }\n            try {\n                String contentType;\n                if (contentTypeAttribute != null) {","sourceCodeStart":880,"sourceCodeEnd":916,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartResponseDecoder.java#L880-L916","documentation":"This ErrorDataDecoderException wraps IOException or UnsupportedCharsetException raised while resolving the charset attribute for a multipart file upload. Charset.forName either could not read the attribute value (IOException) or the charset name is not supported by the JVM (UnsupportedCharsetException), aborting the decode. It indicates an invalid or unreadable charset parameter on the part.","triggerScenarios":"A part declares a charset parameter whose value (via charsetAttribute.getValue()) is unreadable (IOException) or names a charset unavailable on the JVM, e.g. a platform-specific label like 'ANSI_X3.4-1968' on a restricted JVM.","commonSituations":"Servers sending non-standard charset labels; minimal JVM distributions (e.g. compact profiles) lacking extended charsets; corrupted attribute storage causing IO failures.","solutions":["Send a standard charset name such as UTF-8 or ISO-8859-1 in the part's charset parameter, or omit charset entirely.","Log the raw charset value and correct the server-side header generation.","Verify the JVM supports the charset (Charset.isSupported(name)) and use a full JVM profile if needed.","Rule out attribute storage I/O problems by checking temp-dir health when the wrapped cause is IOException."],"exampleFix":"// before\nContent-Disposition: form-data; name=\"f\"; filename=\"a.txt\"; charset=ansi_x3.4-1968\n// after\nContent-Disposition: form-data; name=\"f\"; filename=\"a.txt\"; charset=UTF-8","handlingStrategy":"validation","validationCode":"// Check charset support before emitting the part\nString cs = params.get(\"charset\");\nif (cs != null && !Charset.isSupported(cs.trim().replace(\"\\\"\", \"\"))) {\n    throw new IllegalStateException(\"Unsupported charset label in multipart part: \" + cs);\n}","typeGuard":"static boolean hasSupportedCharset(Attribute charsetAttribute) throws IOException {\n    return charsetAttribute == null\n        || Charset.isSupported(charsetAttribute.getValue().trim());\n}","tryCatchPattern":"try {\n    upload = decoder.getFileUpload(encoding);\n} catch (ErrorDataDecoderException e) {\n    if (e.getCause() instanceof UnsupportedCharsetException) {\n        throw new BadRequestException(\"Part declares a charset unknown to this JVM: \" + e.getCause().getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Use UTF-8 (or ISO-8859-1) charset labels only.","Omit the charset parameter when content is binary.","Test on the target JVM distribution (some lack extended charsets).","Monitor temp-storage health if the wrapped cause is IOException."],"tags":["multipart","charset","unsupported-charset","resteasy-reactive"],"backgroundTag":"unsupported-charset","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}