{"record":{"id":"f89c48507fbf0d69","repo":"quarkusio/quarkus","slug":"name-must-not-be-null-f89c48","errorCode":null,"errorMessage":"name must not be null","messagePattern":"name must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/EntityPartBuilderImpl.java","lineNumber":38,"sourceCode":"import org.jboss.resteasy.reactive.common.util.QuarkusMultivaluedHashMap;\n\npublic class EntityPartBuilderImpl implements EntityPart.Builder {\n\n    private static final Annotation[] EMPTY_ANNOTATIONS = new Annotation[0];\n\n    private final String name;\n    private String fileName;\n    private MediaType mediaType;\n    private MultivaluedMap<String, String> headers;\n    private Serialisers serialisers;\n\n    private Object content;\n    private Class<?> contentType;\n    private Type contentGenericType;\n\n    public EntityPartBuilderImpl(String name, Serialisers serialisers) {\n        if (name == null) {\n            throw new IllegalArgumentException(\"name must not be null\");\n        }\n        this.name = name;\n        this.serialisers = serialisers;\n        this.mediaType = MediaType.APPLICATION_OCTET_STREAM_TYPE;\n        this.headers = new QuarkusMultivaluedHashMap<>();\n    }\n\n    @Override\n    public EntityPart.Builder mediaType(MediaType mediaType) throws IllegalArgumentException {\n        if (mediaType == null) {\n            throw new IllegalArgumentException(\"mediaType must not be null\");\n        }\n        this.mediaType = mediaType;\n        return this;\n    }\n\n    @Override\n    public EntityPart.Builder mediaType(String mediaTypeString) throws IllegalArgumentException {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/EntityPartBuilderImpl.java#L20-L56","documentation":"EntityPart.Builder.builder(name) requires a non-null part name for a multipart part; the name is mandatory per the Jakarta REST EntityPart spec. The EntityPartBuilderImpl constructor validates this immediately and throws IllegalArgumentException when null is passed. Building the part cannot proceed without a name.","triggerScenarios":"Calling EntityPart.builder(null) or EntityPart.withName(null) — any factory call that passes a null name into the EntityPartBuilderImpl constructor.","commonSituations":"Programmatically constructing multipart uploads where the part name comes from a variable or config that is null (e.g. missing form field name, uninitialized constant); refactoring that dropped a name literal.","solutions":["Pass a literal non-null part name: EntityPart.builder(\"file\").","Check the variable feeding builder(...) for null and fix its initialization.","If the name is dynamic, validate it before building and fail fast with a clear error.","Ensure the field/config key supplying the name is actually populated in the environment."],"exampleFix":"// before\nString name = config.get(\"partName\"); // may be null\nEntityPart part = EntityPart.builder(name).build();\n\n// after\nString name = Objects.requireNonNull(config.get(\"partName\"), \"partName\");\nEntityPart part = EntityPart.builder(name).build();","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(partName, \"part name must not be null\");\nEntityPart.Builder b = EntityPart.builder(partName);","typeGuard":"String requirePartName(String name) {\n    return java.util.Objects.requireNonNull(name, \"part name must not be null\");\n}","tryCatchPattern":"try {\n    EntityPart part = EntityPart.builder(name).build();\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Multipart part name was null\", e);\n}","preventionTips":["Use string literals for part names wherever possible.","Validate the name variable at the boundary where it is produced (config/env/input).","Run Objects.requireNonNull early so failures point at the real source."],"tags":["resteasy-reactive","jax-rs","multipart","entitypart","null-argument"],"backgroundTag":"null-required-argument","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"}