{"record":{"id":"91385bd836b980cb","repo":"quarkusio/quarkus","slug":"error-decoding-multipart-field-charset-wrapped-io","errorCode":null,"errorMessage":"Error decoding multipart field charset (wrapped IOException/UnsupportedCharsetException)","messagePattern":"Error decoding multipart field 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":549,"sourceCode":"                // content-disposition: form-data; name=\"pics\"; filename=\"file1.txt\"\n                // and other immediate values like\n                // Content-type: image/gif\n                // Content-Type: text/plain\n                // Content-Type: text/plain; charset=ISO-8859-1\n                // Content-Transfer-Encoding: binary\n                // The following line implies a change of mode (mixed mode)\n                // Content-type: multipart/mixed, boundary=BbC04y\n                return findMultipartDisposition();\n            }\n            case FIELD: {\n                // Now get value according to Content-Type and Charset\n                Charset localCharset = null;\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                Attribute nameAttribute = currentFieldAttributes.get(HttpHeaderValues.NAME);\n                if (currentAttribute == null) {\n                    Attribute lengthAttribute = currentFieldAttributes\n                            .get(HttpHeaderNames.CONTENT_LENGTH);\n                    long size;\n                    try {\n                        size = lengthAttribute != null ? Long.parseLong(lengthAttribute\n                                .getValue()) : 0L;\n                    } catch (IOException e) {\n                        throw new ErrorDataDecoderException(e);\n                    } catch (NumberFormatException ignored) {\n                        size = 0;\n                    }\n                    try {\n                        if (size > 0) {\n                            currentAttribute = factory.createAttribute(response,","sourceCodeStart":531,"sourceCodeEnd":567,"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#L531-L567","documentation":"Within decodeMultipart, a part's Content-Type may carry a charset attribute; if reading its value or resolving the charset fails (IOException from the Attribute or UnsupportedCharsetException from Charset.forName), the exception is wrapped in an ErrorDataDecoderException.","triggerScenarios":"A multipart part declares 'Content-Type: text/plain; charset=<name>' where the name is an unsupported/unknown charset (e.g. charset=Cp1257 on a JVM lacking that charset, or a typo like charset=UTF_8), and getAttribute().getValue() throws IOException.","commonSituations":"Servers emitting non-standard charset names; JVM with a restricted charset provider; corrupted part headers.","solutions":["Fix the server to emit a standard supported charset name (e.g. UTF-8)","Verify the charset is supported on the running JVM (Charset.isSupported(name))","Strip the charset parameter from the part so the decoder's default charset is used","Catch ErrorDataDecoderException and decode the raw bytes manually"],"exampleFix":"// before (server part header)\nContent-Type: text/plain; charset=UTF_8\n// after\nContent-Type: text/plain; charset=UTF-8","handlingStrategy":"validation","validationCode":"String cs = partContentTypeCharset; // parsed from part header\nif (cs != null && !Charset.isSupported(cs)) {\n    log.warn(\"Unsupported charset \" + cs + \", using default\");\n}","typeGuard":null,"tryCatchPattern":"try { decoder.offer(chunk); } catch (ErrorDataDecoderException e) { if (e.getCause() instanceof UnsupportedCharsetException) { /* decode raw bytes with UTF-8 */ } }","preventionTips":["Restrict server to widely-supported charsets (UTF-8, ISO-8859-1)","Check Charset.isSupported() for any user-configured charset"],"tags":["http","multipart","charset"],"backgroundTag":"unsupported-charset","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}