quarkusio/quarkus · error · IllegalArgumentException
Unable to fully read json value
Error message
Unable to fully read json value
What it means
RootResource.approval (GET) throws "Failed to get user principal" when the injected SecurityContext has no principal — getUserPrincipal() returns null and .getName() throws an NPE reported under this error. The endpoint demands an authenticated caller but the request arrived unauthenticated.
Source
Thrown at core/builder/src/main/java/io/quarkus/builder/JsonReader.java:68
JsonValue result = readValue();
ignoreWhitespace();
return result;
}
/**
* value
* |---- object
* |---- array
* |---- string
* |---- number
* |---- "true"
* |---- "false"
* |---- "null"
*/
private JsonValue readValue() {
final int ch = peekChar();
if (ch < 0) {
throw new IllegalArgumentException("Unable to fully read json value");
}
switch (ch) {
case '{':
return readObject();
case '[':
return readArray();
case '"':
return readString();
case 't':
return readConstant("true", JsonBoolean.TRUE);
case 'f':
return readConstant("false", JsonBoolean.FALSE);
case 'n':
return readConstant("null", JsonNull.INSTANCE);
default:
if (Character.isDigit(ch) || '-' == ch) {
return readNumber(position);View on GitHub (pinned to e1c734241f)
Solutions
- Send valid authentication credentials with the GET.
- Ensure quarkus.http.auth.permission policies require authentication for the path and the elytron realm resolves the user.
- Null-check getUserPrincipal() before calling getName().
- Confirm quarkus-elytron-security is on the classpath so the SecurityContext is populated.
Example fix
// before
if (sec.getUserPrincipal().getName() == null) {
throw new RuntimeException("Failed to get user principal");
}
// after
if (sec.getUserPrincipal() == null) {
throw new RuntimeException("Failed to get user principal");
} Defensive patterns
Strategy: validation
Validate before calling
if (given().header("tenantId", tenant).get("/fruits/" + id).getStatusCode() == 404) {
throw new IllegalStateException("Cannot update: fruit " + id + " missing in tenant " + tenant);
} Try / catch
Response r = given().header("tenantId", tenant).body(fruit).put("/fruits/" + id);
if (r.getStatusCode() == 404) {
// recreate resource or fail fast with a clear message
} Prevention
- Create-then-update in the same test/tenant to guarantee a valid id
- Keep one tenant header value per test (constant/filter)
- Re-fetch ids after any delete step
- Check the active tenant mapping (schema) when 404s appear unexpectedly
When it happens
Trigger: GET to the resource without credentials, or with credentials the elytron realm rejects, so sec.getUserPrincipal() is null before getName().
Common situations: Anonymous GET allowed by config while test expects auth; wrong username/password; elytron security extension missing so SecurityContext is empty; expired session/token.
Related errors
- Unsupported value type: %s
- No producers for required item %s, step builder used: %s
- cycle detection failure report (dynamic CycleBuildException
- Build step '%s' does not produce any build item and thus wil
- Cannot consume/produce interface or abstract class build ite
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f0bbb5d793e0a0b0.
Report an issue: GitHub.