quarkusio/quarkus · error · UnsupportedOperationException

Unsupported type: " + x

Error message

Unsupported type: " + x

What it means

RedisCommand.put(Object) accepts only String, RedisCommandExtraArguments, or List arguments when building a Redis command. Any other type is rejected with UnsupportedOperationException at command-construction time, before anything is sent to the server.

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/RedisCommand.java:45

        if (x instanceof String) {
            this.request.arg(x.toString());
        } else if (x instanceof Double) {
            this.request.arg((double) x);
        } else if (x instanceof Long) {
            this.request.arg((long) x);
        } else if (x instanceof Integer) {
            this.request.arg((int) x);
        } else if (x instanceof Boolean) {
            this.request.arg((boolean) x);
        } else if (x instanceof byte[]) {
            this.request.arg(Buffer.buffer((byte[]) x));
        } else if (x instanceof RedisCommandExtraArguments) {
            putArgs((RedisCommandExtraArguments) x);
        } else if (x instanceof List) {
            //noinspection rawtypes
            putAll((List) x);
        } else {
            throw new UnsupportedOperationException("Unsupported type: " + x);
        }
        return this;
    }

    public RedisCommand putAll(List<?> args) {
        for (Object arg : args) {
            put(arg);
        }
        return this;
    }

    public RedisCommand putAll(String[] args) {
        for (Object arg : args) {
            put(arg);
        }
        return this;
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Convert primitive/other arguments to String before passing
  2. Implement RedisCommandExtraArguments for structured options
  3. Pass a List of string args for multi-value arguments

Example fix

// before
command._ftSugAdd(key, value, 1); // int passed directly
// after
command._ftSugAdd(key, value, String.valueOf(score));
Defensive patterns

Strategy: validation

Validate before calling

if (!(x instanceof String || x instanceof RedisCommandExtraArguments || x instanceof List)) {
    throw new IllegalArgumentException("arg must be String, RedisCommandExtraArguments or List: " + x.getClass());
}

Type guard

static boolean isSupportedArg(Object x) {
    return x instanceof String || x instanceof RedisCommandExtraArguments || x instanceof List;
}

Try / catch

try {
    command._ftSugAdd(key, value, arg);
} catch (UnsupportedOperationException e) {
    log.error("Unsupported command argument type: " + e.getMessage());
}

Prevention

When it happens

Trigger: Passing an unsupported argument type (e.g. raw Integer, Map, custom object) to methods like _ftSugAdd, _bfmadd, _bfmexists, _bfinsert, _cmsIncrBy, or _cmsQuery through extra arguments.

Common situations: Passing numeric values unboxed instead of String.valueOf(...); passing a Map of options instead of a RedisCommandExtraArguments implementation; upgrading Quarkus and passing previously-tolerated types.

Related errors


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