{"record":{"id":"2dd5c65d2474aa2e","repo":"quarkusio/quarkus","slug":"unsupported-value-type-s","errorCode":null,"errorMessage":"Unsupported value type: %s","messagePattern":"Unsupported value type: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/builder/src/main/java/io/quarkus/builder/Json.java","lineNumber":411,"sourceCode":"                    if (!objectBuilder.isEmpty()) {\n                        put(attribute, objectBuilder);\n                    }\n                }\n            }\n        }\n    }\n\n    static void appendValue(Appendable appendable, Object value, boolean skipEscapeCharacters) throws IOException {\n        if (value instanceof JsonObjectBuilder) {\n            appendable.append(((JsonObjectBuilder) value).build());\n        } else if (value instanceof JsonArrayBuilder) {\n            appendable.append(((JsonArrayBuilder) value).build());\n        } else if (value instanceof String) {\n            appendStringValue(appendable, value.toString(), skipEscapeCharacters);\n        } else if (value instanceof Boolean || value instanceof Integer || value instanceof Long) {\n            appendable.append(value.toString());\n        } else {\n            throw new IllegalStateException(\"Unsupported value type: \" + value);\n        }\n    }\n\n    static void appendStringValue(Appendable appendable, String value, boolean skipEscapeCharacters) throws IOException {\n        appendable.append(CHAR_QUOTATION_MARK);\n        if (skipEscapeCharacters) {\n            appendable.append(value);\n        } else {\n            appendable.append(escape(value));\n        }\n        appendable.append(CHAR_QUOTATION_MARK);\n    }\n\n    /**\n     * Escape quotation mark, reverse solidus and control characters (U+0000 through U+001F).\n     *\n     * @param value\n     * @return escaped value","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/builder/src/main/java/io/quarkus/builder/Json.java#L393-L429","documentation":"RootResource.posts throws \"Failed to get user principal\" when sec.getUserPrincipal() is null (NPE from getName()) or has a null name, after the body check passes. It means the REST endpoint was reached without an authenticated identity despite the test expecting Elytron to authenticate the caller.","triggerScenarios":"POST with a valid text/plain body but no/invalid credentials, so SecurityContext.getUserPrincipal() returns null and .getName() throws.","commonSituations":"Missing Authorization header; quarkus.http.auth.policy/permission config not requiring auth for the path; elytron realm identity not found; principal propagated with null name.","solutions":["Send valid basic-auth credentials with the POST.","Configure quarkus.http.auth.permission policies to require authentication and a working elytron identity realm.","Null-check sec.getUserPrincipal() before getName().","Verify SecurityContext injection is backed by the Elytron identity (quarkus-elytron-security present)."],"exampleFix":"// before\nif (sec.getUserPrincipal().getName() == null) {\n    throw new RuntimeException(\"Failed to get user principal\");\n}\n// after\nif (sec.getUserPrincipal() == null) {\n    throw new RuntimeException(\"Failed to get user principal\");\n}","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(fruit.getName(), \"name is required for PUT /fruits/{id}\");","typeGuard":"static boolean isUpdatable(Fruit f) {\n    return f != null && f.getName() != null && !f.getName().isBlank();\n}","tryCatchPattern":"try {\n    given().body(fruit).put(\"/fruits/\" + id);\n} catch (WebApplicationException e) {\n    if (e.getResponse().getStatus() == 422) { /* supply a name and retry */ }\n    else throw e;\n}","preventionTips":["Validate required fields (name) before sending PUT","Remember PUT requires full representation; use fetch-modify-PUT for partial changes","Make UI forms require the name field before submit","In tests, always construct Fruit with a non-null name"],"tags":["rest","jaxrs","security","elytron"],"backgroundTag":"unauthenticated-request-no-principal","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}