quarkusio/quarkus · error · IllegalArgumentException

`member` cannot be `null`

Error message

`member` cannot be `null`

What it means

GeoSearchArgs.fromMember sets the origin of a geo search to an existing sorted-set member. A null member would produce a malformed GEOSEARCH command, so the method eagerly throws IllegalArgumentException with this message. The origin must be either a member name (FROMMEMBER) or coordinates (FROMLONLAT), never null.

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/geo/GeoSearchArgs.java:46

     * The direction (ASC or DESC)
     */
    private String direction;

    private boolean withDistance;

    private boolean withCoordinates;

    private boolean withHash;

    /**
     * Use the position of the given existing {@code member} in the sorted set.
     *
     * @param member the member, must not be {@code null}
     * @return the current {@code GeoSearchArgs}
     */
    public GeoSearchArgs<V> fromMember(V member) {
        if (member == null) {
            throw new IllegalArgumentException("`member` cannot be `null`");
        }
        this.member = member;
        return this;
    }

    /**
     * Use the given {@code longitude} and {@code latitude} position.
     *
     * @param longitude the longitude
     * @param latitude the latitude
     * @return the current {@code GeoSearchArgs}
     */
    public GeoSearchArgs<V> fromCoordinate(double longitude, double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
        return this;
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Check the member value for null before calling fromMember and handle the absent case in caller logic
  2. Provide coordinates via fromLongitudeLatitude(...) instead when the member may not exist
  3. Use Objects.requireNonNull with a clear message at the source of the value to fail earlier

Example fix

// before
String member = lookupMember(id); // may return null
GeoSearchArgs<String> args = GeoSearchArgs.fromMember(member);
// after
String member = lookupMember(id);
if (member == null) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
}
GeoSearchArgs<String> args = GeoSearchArgs.fromMember(member);
Defensive patterns

Strategy: type-guard

Validate before calling

if (member == null) { throw new IllegalStateException("member is required"); }

Type guard

boolean hasMember(String m) { return m != null && !m.isBlank(); }

Try / catch

try { args.fromMember(member); } catch (IllegalArgumentException e) { return Response.status(400, e.getMessage()).build(); }

Prevention

When it happens

Trigger: Calling GeoSearchArgs.fromMember(null), typically when the member value comes from a variable, request parameter, or lookup that returned null.

Common situations: Member names derived from user input or an upstream database record that does not exist; deserialization producing null; passing an Optional unwrapped incorrectly.

Related errors


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