{"record":{"id":"d77384fbb2db7a0e","repo":"quarkusio/quarkus","slug":"error-decoding-multipart-field-attribute-wrapped","errorCode":null,"errorMessage":"Error decoding multipart field attribute (wrapped NullPointerException/IllegalArgumentException/IOException)","messagePattern":"Error decoding multipart field attribute \\(wrapped NullPointerException/IllegalArgumentException/IOException\\)","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":561,"sourceCode":"                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,\n                                    cleanString(nameAttribute.getValue()), size);\n                        } else {\n                            currentAttribute = factory.createAttribute(response,\n                                    cleanString(nameAttribute.getValue()));\n                        }\n                    } catch (NullPointerException | IllegalArgumentException | IOException e) {\n                        throw new ErrorDataDecoderException(e);\n                    }\n                    if (localCharset != null) {\n                        currentAttribute.setCharset(localCharset);\n                    }\n                }","sourceCodeStart":543,"sourceCodeEnd":579,"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#L543-L579","documentation":"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.)","triggerScenarios":"A part declares Content-Length: N (N > 0) and lengthAttribute.getValue() throws IOException while reading the header value from the underlying buffer/attribute.","commonSituations":"Malformed or truncated part headers from a broken server/proxy; I/O failure while lazily reading the attribute value.","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"],"exampleFix":"// before (part)\nContent-Disposition: form-data; name=\"f\"\nContent-Length: (unparseable/garbled value)\n// after\nContent-Disposition: form-data; name=\"f\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { decoder.offer(chunk); } catch (ErrorDataDecoderException e) { if (e.getCause() instanceof IOException) { log.error(\"I/O reading multipart part headers\", e); } }","preventionTips":["Avoid per-part Content-Length headers unless needed","Monitor for truncated connections (proxy timeouts)","Log raw part headers on decode failure"],"tags":["http","multipart","io"],"backgroundTag":"malformed-multipart-headers","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"}