quarkusio/quarkus · error · ErrorDataDecoderException

Filename not found

Error message

Filename not found

What it means

In mixed multipart mode, the decoder found a form field (name attribute) without a filename attribute. Only file uploads are supported inside multipart/mixed sections, so parsing fails with 'Filename not found'. This enforces that every part within a mixed block is a file upload.

Source

Thrown at independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/multipart/QuarkusMultipartResponseDecoder.java:824

                // FileUpload
                currentStatus = MultiPartStatus.FILEUPLOAD;
                // do not change the buffer position
                return decodeMultipart(MultiPartStatus.FILEUPLOAD);
            } else {
                // Field
                currentStatus = MultiPartStatus.FIELD;
                // do not change the buffer position
                return decodeMultipart(MultiPartStatus.FIELD);
            }
        } else {
            if (filenameAttribute != null) {
                // FileUpload
                currentStatus = MultiPartStatus.MIXEDFILEUPLOAD;
                // do not change the buffer position
                return decodeMultipart(MultiPartStatus.MIXEDFILEUPLOAD);
            } else {
                // Field is not supported in MIXED mode
                throw new ErrorDataDecoderException("Filename not found");
            }
        }
    }

    private static final String FILENAME_ENCODED = HttpHeaderValues.FILENAME.toString() + '*';

    private Attribute getContentDispositionAttribute(String... values) {
        String name = cleanString(values[0]);
        String value = values[1];

        // Filename can be token, quoted or encoded. See https://tools.ietf.org/html/rfc5987
        if (HttpHeaderValues.FILENAME.contentEquals(name)) {
            // Value is quoted or token. Strip if quoted:
            int last = value.length() - 1;
            if (last > 0 &&
                    value.charAt(0) == HttpConstants.DOUBLE_QUOTE &&
                    value.charAt(last) == HttpConstants.DOUBLE_QUOTE) {
                value = value.substring(1, last);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure every part inside multipart/mixed includes a filename parameter in Content-Disposition.
  2. Move plain (non-file) fields out of the mixed section into the outer multipart body.
  3. Fix the server serializer so mixed sections only contain file attachments.
  4. If the payload is legitimate, handle it with a custom parser instead of the built-in decoder.

Example fix

// before (field inside mixed, no filename)
Content-Disposition: form-data; name="note"
// after
Content-Disposition: form-data; name="attachment"; filename="note.txt"
Defensive patterns

Strategy: validation

Validate before calling

// Ensure every part inside multipart/mixed carries a filename
mixedParts.forEach(p -> {
    if (p.filename() == null || p.filename().isBlank()) {
        throw new IllegalStateException("Part '" + p.name() + "' in multipart/mixed must have a filename");
    }
});

Type guard

static boolean isFilePart(DispositionPart p) {
    return p != null && p.filename() != null && !p.filename().isBlank();
}

Try / catch

try {
    return decoder.decodeMultipart(MIXEDDELIMITER);
} catch (ErrorDataDecoderException e) {
    if ("Filename not found".equals(e.getMessage())) {
        throw new UnsupportedMixedFieldException("Plain fields are not allowed inside multipart/mixed", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Inside a multipart/mixed section, a part's Content-Disposition has a 'name' but no 'filename' parameter, so the MIXEDFILEUPLOAD transition cannot complete.

Common situations: Servers embedding plain fields inside multipart/mixed blocks; hand-written multipart serializers mixing fields and files in a mixed section; email-style bodies reused over HTTP.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/8c225da270598fa3. Report an issue: GitHub.