You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ClientRegistration is missing on reflect-config.json #386
I'm using spring boot native and I'm getting an HTTP 400 error on /api/client/register:
POST /api/client/register HTTP/1.1
Accept: application/json
Content-Type: application/json
UNLEASH-APPNAME: xpto-reader
X-UNLEASH-APPNAME: xpto-reader
UNLEASH-INSTANCEID: xpto
X-UNLEASH-CONNECTION-ID: 288de440-48ba-4759-afc2-3f983ace64fd
X-UNLEASH-SDK: unleash-client-java:9.3.2
User-Agent: xpto-reader
Unleash-Client-Spec: 5.1.5
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:4242
Connection: keep-alive
Content-Length: 2
{}
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 338
ETag: W/"152-ohDoS0QSWDVe++vcJVvLFMVx30U"
Vary: Accept-Encoding
Date: Tue, 01 Sep 2026 19:00:45 GMT
Connection: keep-alive
Keep-Alive: timeout=15
{"id":"eeb43217-6414-46e2-9d39-b3e6e609da1f","name":"BadDataError","message":"Request validation failed: your request body or params contain invalid data. Refer to the `details` list for more information.","details":[{"path":"/body/appName","message":"The `/body/appName` property is required. It was not present on the data you sent."}]}
Steps to reproduce the bug
Build a spring boot native application. As soon as the app starts, the endpoint is called and a 400 is returned.
Thanks @fabionb for the detailed report. The important detail here is that the request body is {}. This looks like a native-image serialization issue rather than a problem with the configured appName.
Java SDK 9.3.2 does copy the configured application name into ClientRegistration, and the correct value in the request headers confirms that the configuration is available. However, ClientRegistration is not part of the reflection metadata bundled with that SDK version, that Gson uses to serialize objects. In a Spring Boot native executable, Gson cannot discover those fields in the same way it can on a regular JVM, so it serializes the registration as {}. The missing appName is then simply the first validation error reported by the server but the whole body shouldn't be an empty object.
Your suggestion about ClientMetrics is probably correct because all outgoing requests follow the same Gson serialization path and that class is also absent from the bundled reflection metadata.
Both versions are fairly old at this point: Java SDK 9.3.2 was released in January 2025, and Unleash Server 6.10.1 in June 2025. We recommend upgrading both where possible. That said, we checked the current code still has these classes absent from the reflection metadata, so upgrading the SDK alone would not fix this particular serialization problem. But if you want to contribute with a PR, we'll gladly accept it.
We have previously accepted some best-effort native-image improvements, such as the initial reachability metadata (#267, #268), a native-image example (#332), and a targeted GraalVM-compatible HTTP change (#377, #378). However, native images have not been an officially supported target, and we do not have comprehensive native-image test coverage. We attempted to add a smoke test in #379, but closed it because it did not catch the problem it was meant to validate.
As a possible workaround, you can add reflection metadata with declared-field access for:
io.getunleash.metric.ClientRegistration
io.getunleash.metric.ClientMetrics
That should address the serialization path visible in this report, but we cannot guarantee that these are the only classes or runtime behaviors that need additional native-image configuration.
Hi @fabionb yes, this would be my suggestion as well, and maybe this was an oversight or just incremental build, somebody asked for the other classes and we just added the ones requested.
Activity
fabionb commentedon Sep 1, 2026
Maybe ClientMetrics have the same problem.
gastonfournier commentedon Sep 2, 2026
Thanks @fabionb for the detailed report. The important detail here is that the request body is
{}. This looks like a native-image serialization issue rather than a problem with the configuredappName.Java SDK 9.3.2 does copy the configured application name into
ClientRegistration, and the correct value in the request headers confirms that the configuration is available. However,ClientRegistrationis not part of the reflection metadata bundled with that SDK version, that Gson uses to serialize objects. In a Spring Boot native executable, Gson cannot discover those fields in the same way it can on a regular JVM, so it serializes the registration as{}. The missingappNameis then simply the first validation error reported by the server but the whole body shouldn't be an empty object.Your suggestion about
ClientMetricsis probably correct because all outgoing requests follow the same Gson serialization path and that class is also absent from the bundled reflection metadata.Both versions are fairly old at this point: Java SDK 9.3.2 was released in January 2025, and Unleash Server 6.10.1 in June 2025. We recommend upgrading both where possible. That said, we checked the current code still has these classes absent from the reflection metadata, so upgrading the SDK alone would not fix this particular serialization problem. But if you want to contribute with a PR, we'll gladly accept it.
We have previously accepted some best-effort native-image improvements, such as the initial reachability metadata (#267, #268), a native-image example (#332), and a targeted GraalVM-compatible HTTP change (#377, #378). However, native images have not been an officially supported target, and we do not have comprehensive native-image test coverage. We attempted to add a smoke test in #379, but closed it because it did not catch the problem it was meant to validate.
As a possible workaround, you can add reflection metadata with declared-field access for:
io.getunleash.metric.ClientRegistrationio.getunleash.metric.ClientMetricsThat should address the serialization path visible in this report, but we cannot guarantee that these are the only classes or runtime behaviors that need additional native-image configuration.
fabionb commentedon Sep 2, 2026
Hi @gastonfournier , thank you for your help.
Yes, I solved it by registering these classes:
My suggestion is to add these classes into the file in unleash-java-sdk: https://github.com/Unleash/unleash-java-sdk/blob/unleash-client-java-9.3.2/src/main/resources/META-INF/native-image/io.getunleash/unleash-client-java/reflect-config.json since all other serialized classes that are registered here are working as expected. It seems to me that the unleash library forget to register it.
fabionb commentedon Sep 2, 2026
Regarding to upgrade the library: I'll do it as soon as possible, but the newer version probably will have the same problem.
gastonfournier commentedon Sep 9, 2026
Hi @fabionb yes, this would be my suggestion as well, and maybe this was an oversight or just incremental build, somebody asked for the other classes and we just added the ones requested.