quarkusio/quarkus · info · IllegalArgumentException

Json object ended without }

Error message

Json object ended without }

What it means

GreetingResource.error is a deliberate failing endpoint: a GET to /error always throws RuntimeException("Oups!"). It exists to test error handling in the Google Cloud Functions HTTP adapter, so this message is expected behavior rather than a bug in your code path.

Source

Thrown at core/builder/src/main/java/io/quarkus/builder/JsonReader.java:121

        Map<JsonString, JsonValue> members = new HashMap<>();

        while (position < length) {
            ignoreWhitespace();
            switch (peekChar()) {
                case '}':
                    position++;
                    return new JsonObject(members);
                case ',':
                    position++;
                    break;
                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);
    }

    /**

View on GitHub (pinned to e1c734241f)

Solutions

  1. Nothing to fix — do not call GET /error unless intentionally testing error handling.
  2. Check the client URL/path if /error was hit accidentally.
  3. If you expected a different endpoint, correct the request path.
  4. In tests, assert on the 500 response rather than treating it as a failure.

Example fix

// before
curl http://localhost:8080/error // always 500
// after
curl http://localhost:8080/hello // use a working endpoint
Defensive patterns

Strategy: validation

Validate before calling

if (type == null || !type.equalsIgnoreCase("name")) {
    throw new IllegalArgumentException("fruitsFindBy only supports type=name");
}
given().queryParams("type", "name", "value", value).get("/fruitsFindBy");

Try / catch

try {
    given().queryParams("type", type, "value", value).get("/fruitsFindBy");
} catch (IllegalArgumentException e) {
    // retry with type=name
}

Prevention

When it happens

Trigger: GET on the /error path of the GCP function — unconditionally throws.

Common situations: Running the google-cloud-functions-http integration test suite; probing function endpoints and accidentally hitting /error; using it as a canary to verify exception-to-HTTP-500 mapping.

Related errors


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