{"record":{"id":"d51b72a3ae9558d9","repo":"quarkusio/quarkus","slug":"etag-was-null-d51b72","errorCode":null,"errorMessage":"etag was null","messagePattern":"etag was null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RequestImpl.java","lineNumber":179,"sourceCode":"        }\n        if (builder == null) {\n            String ifUnmodifiedSince = headers.getFirst(HttpHeaders.IF_UNMODIFIED_SINCE);\n            if (ifUnmodifiedSince != null && (!isRfc7232preconditions() || (!headers.containsKey(HttpHeaders.IF_MATCH)))) {\n                builder = ifUnmodifiedSince(ifUnmodifiedSince, lastModified);\n            }\n        }\n        if (builder != null && varyHeader != null)\n            builder.header(HttpHeaders.VARY, varyHeader);\n\n        return builder;\n    }\n\n    @Override\n    public Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag) {\n        if (lastModified == null)\n            throw new IllegalArgumentException(\"Last modified was null\");\n        if (eTag == null)\n            throw new IllegalArgumentException(\"etag was null\");\n        Response.ResponseBuilder rtn = null;\n        Response.ResponseBuilder lastModifiedBuilder = evaluatePreconditions(lastModified);\n        Response.ResponseBuilder etagBuilder = evaluatePreconditions(eTag);\n        if (lastModifiedBuilder == null && etagBuilder == null)\n            rtn = null;\n        else if (lastModifiedBuilder != null && etagBuilder == null)\n            rtn = lastModifiedBuilder;\n        else if (lastModifiedBuilder == null && etagBuilder != null)\n            rtn = etagBuilder;\n        else {\n            rtn = lastModifiedBuilder;\n            rtn.tag(eTag);\n        }\n        if (rtn != null && varyHeader != null)\n            rtn.header(HttpHeaders.VARY, varyHeader);\n        return rtn;\n    }\n","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RequestImpl.java#L161-L197","documentation":"RequestImpl.evaluatePreconditions(Date, EntityTag) throws IllegalArgumentException when the EntityTag argument is null. Both parameters are mandatory in the two-argument overload per the JAX-RS specification.","triggerScenarios":"Calling the (Date, EntityTag) overload with a null EntityTag, usually because ETag generation is conditional in the application code.","commonSituations":"Caching disabled in some environments so no ETag is produced; a getter returning null for weak entities; refactor changed an Optional-style ETag into a bare null argument.","solutions":["Always build a non-null EntityTag (e.g. hash of the representation) before this call.","If only lastModified is known, use the single-arg evaluatePreconditions(Date) overload.","Branch on the null ETag and call the appropriate overload or the no-arg variant.","Note: the thrown message is the lowercase 'etag was null', distinct from 'ETag was null' of the single-arg overload."],"exampleFix":"// before\nreturn request.evaluatePreconditions(lastModified, etag);\n// after\nif (etag == null) {\n    return request.evaluatePreconditions(lastModified);\n}\nreturn request.evaluatePreconditions(lastModified, etag);","handlingStrategy":"type-guard","validationCode":"if (etag == null) {\n    return request.evaluatePreconditions(lastModified);\n}","typeGuard":"boolean hasEtag(EntityTag t) {\n    return t != null;\n}","tryCatchPattern":"try {\n    return request.evaluatePreconditions(lastModified, etag);\n} catch (IllegalArgumentException e) {\n    return request.evaluatePreconditions(lastModified);\n}","preventionTips":["Generate an EntityTag unconditionally for cached resources","Use the Date-only overload when no ETag exists","Never chain Optional.get() results into this API"],"tags":["jaxrs","resteasy-reactive","etag","conditional-request"],"backgroundTag":"null-etag-precondition","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"}