quarkusio/quarkus · error · IllegalArgumentException

Unknown JSON Value ${kind}

Error message

Unknown JSON Value ${kind}

What it means

VertxJson.copy(JsonObject, jakarta.json.JsonObject) converts a Jakarta JSON object into a Vert.x JsonObject by switching on each value's JsonValue.ValueType kind. If a value has a kind the switch does not handle (anything other than STRING, NUMBER, TRUE, FALSE, NULL, OBJECT), it throws this IllegalArgumentException. It means the JSON document contained a value type the converter cannot map.

Source

Thrown at extensions/resteasy-classic/resteasy-jsonb/runtime/src/main/java/io/quarkus/resteasy/jsonb/vertx/VertxJson.java:73

                    JsonNumber number = origin.getJsonNumber(key);
                    if (number.isIntegral()) {
                        object.put(key, number.longValue());
                    } else {
                        object.put(key, number.doubleValue());
                    }
                    break;
                case ARRAY:
                    JsonArray array = new JsonArray();
                    copy(array, origin.getJsonArray(key));
                    object.put(key, array);
                    break;
                case OBJECT:
                    JsonObject json = new JsonObject();
                    copy(json, origin.getJsonObject(key));
                    object.put(key, json);
                    break;
                default:
                    throw new IllegalArgumentException("Unknown JSON Value " + kind);
            }
        });
    }

    public static void copy(JsonArray array, jakarta.json.JsonArray origin) {
        for (int i = 0; i < origin.size(); i++) {
            JsonValue value = origin.get(i);
            JsonValue.ValueType kind = value.getValueType();
            switch (kind) {
                case STRING:
                    array.add(origin.getString(i));
                    break;
                case TRUE:
                    array.add(true);
                    break;
                case FALSE:
                    array.add(false);
                    break;

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the jakarta.json document and normalize unsupported value kinds before copying (e.g. convert arrays/scalars explicitly).
  2. Extend or replace the conversion: write your own mapper using jsonValue.valueType() covering ARRAY, or use JsonObject.wrap()/Json.createValue conversions.
  3. Report/patch the switch in VertxJson to handle the missing ValueType case.

Example fix

// before
switch (origin.get(key).getValueType()) { /* no ARRAY case */ }

// after: guard before copy
JsonValue v = origin.get(key);
if (v.getValueType() == JsonValue.ValueType.ARRAY) {
    object.put(key, VertxJson.copy(new JsonArray(), v.asJsonArray()));
} else {
    copyInto(object, key, v);
}
Defensive patterns

Strategy: validation

Validate before calling

static boolean isCopyable(JsonObject origin) {
    return origin.entrySet().stream()
        .allMatch(e -> EnumSet.of(JsonValue.ValueType.STRING, JsonValue.ValueType.NUMBER,
                JsonValue.ValueType.TRUE, JsonValue.ValueType.FALSE,
                JsonValue.ValueType.NULL, JsonValue.ValueType.OBJECT)
            .contains(e.getValue().getValueType()));
}

Type guard

static boolean isSupportedKind(JsonValue v) {
    JsonValue.ValueType t = v.getValueType();
    return t != JsonValue.ValueType.ARRAY; // ARRAY (and any unhandled kind) is not supported by this copy()
}

Try / catch

try {
    VertxJson.copy(target, jakartaObject);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unknown JSON Value")) {
        throw new IllegalStateException("Document contains an unsupported JSON value kind: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling VertxJson.copy(JsonObject, jakarta.json.JsonObject) on a JsonObject containing a jakarta.json value whose ValueType falls through the switch — in practice an unhandled kind such as a JSON array nested where only scalar/object cases were coded, or unusual JsonValue implementations.

Common situations: Converting JSON-P structures built by other libraries that produce JsonValue subtypes (e.g. JsonNumber variants or custom implementations) which don't map to the expected enum branches; version changes in jakarta.json introducing new value kinds.

Related errors


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