quarkusio/quarkus · error · IllegalArgumentException

Expected : after attribute

Error message

Expected : after attribute

What it means

After reading a member's attribute (key string) in a JSON object, readMember() requires the next non-whitespace character to be ':'. If it is anything else, the object syntax is invalid and IllegalArgumentException is thrown. This enforces the JSON grammar rule 'string ws ":" value'.

Source

Thrown at independent-projects/bootstrap/json/src/main/java/io/quarkus/bootstrap/json/JsonReader.java:121

                case '"':
                    readMember(members);
                    break;
            }
        }

        throw new IllegalArgumentException("Json object ended without }");
    }

    /**
     * member
     * |----- ws string ws ':' element
     */
    private void readMember(Map<JsonString, JsonValue> members) {
        final JsonString attribute = readString();
        ignoreWhitespace();
        final int colon = nextChar();
        if (':' != colon) {
            throw new IllegalArgumentException("Expected : after attribute");
        }
        final JsonValue element = readElement();
        members.put(attribute, element);
    }

    /**
     * array
     * |---- '[' ws ']'
     * |---- '[' elements ']'
     * </p>
     * elements
     * |----- element
     * |----- element ',' elements
     */
    private JsonValue readArray() {
        position++;

        final List<JsonValue> elements = new ArrayList<>();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Replace '=' with ':' between each key and value in the JSON object
  2. Check that every member has the form "key": value with the colon present
  3. Validate the JSON with a validator to pinpoint all syntax issues at once

Example fix

// before
{"key"=1}
// after
{"key":1}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-scan for the '=' typo pattern inside JSON: "key"=value
if (jsonText.matches("(?s).*\"[^\"]+\"\\s*=.*")) {
    throw new IllegalArgumentException("JSON uses '=' instead of ':'");
}

Try / catch

try {
    JsonValue v = new JsonReader(text).read();
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Expected : after attribute")) {
        // hint to user: properties-file syntax used instead of JSON syntax
    }
}

Prevention

When it happens

Trigger: A JSON member uses '=' instead of ':', or omits the colon entirely, e.g. '{"a" 1}' or '{"a"=1}'. Also triggered by a missing quote that makes the key parse differently than intended.

Common situations: Confusing properties-file syntax (key=value) with JSON; hand-editing JSON and deleting the colon; copy/paste from config files into JSON.

Related errors


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