Skip to content

[BUG] /api/speed returns 400 "Serializer for class 'SpeedModeState' is not found" on v0.10.5 server (speed modes unusable over REST) #685

Open

Description

@lianlonggang

Summary

On the Docker/server build of Ketch v0.10.5 (ghcr.io/linroid/ketch, linux/arm64), GET /api/speed fails with HTTP 400:

{"error":"bad_request","message":"Serializer for class 'SpeedModeState' is not found.\nPlease ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.\n","revision":null}

PUT /api/speed fails the same way (the response serializes the same state). So speed-mode control via REST is unusable against the server — which is what docs/api.md describes as the supported path: "Over REST: GET /api/speed and PUT /api/speed".

Reproduce

docker run -d --name ketch -p 8642:8642 -v /tmp/ketch:/config ghcr.io/linroid/ketch
TOKEN=*** /tmp/ketch/config/api-token)
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8642/api/speed
# -> HTTP 400, body above

What makes this surprising (checked against the v0.10.5 tag)

  • SpeedModeState in library/api/.../SpeedModes.kt is @Serializable (line 49), and library/api/api/jvm/api.api shows the generated companion — so the plugin clearly ran for the defining module.
  • StreamSerializers registers subclass(Interest.SpeedMode::class), so the polymorphic interest type is known.
  • On the same native server binary, other call.respond(...) endpoints serialize fine — e.g. GET /api/status returns the full status JSON from the very same instance.
  • speedRoutes responds with modes.state() via call.respond(...) (Ktor content negotiation, runtime KClass serializer lookup). The lookup fails specifically for this type at runtime, which suggests the serializer is not reachable in the native-image configuration for this reflection-based path (or the state returned by SpeedModes.state() is an instance of a class other than the annotated one at runtime).

Environment

  • Image ghcr.io/linroid/ketch:latest, digest sha256:1209cf45ff9e..., CLI Ketch CLI - Version 0.10.5 (0759370)
  • linux/arm64 (Raspberry Pi, Docker 29.6.1)
  • Related test exists: library/server/src/test/kotlin/com/linroid/ketch/server/RemoteSpeedModesTest.kt (JVM) — so this may pass tests but fail in the native binary.

Not sure whether amd64 native builds hit this too; happy to test on more environments if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions