spring-projects / spring-projects/spring-ai

No serializer found for class software.amazon.awssdk.services.bedrockruntime.model.TokenUsage

Open
#5,682 1 comment 0 reactions 1 assignee View on GitHub

@sobychacko is already working on this.

Since Sep 5, 2026.

Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
After upgrade from Spring AI 1.1.2 to 1.1.3 following Exception is thrown:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class software.amazon.awssdk.services.bedrockruntime.model.TokenUsage and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.springframework.ai.chat.model.ChatResponse["metadata"]->org.springframework.ai.chat.metadata.ChatResponseMetadata["usage"]->org.springframework.ai.chat.metadata.DefaultUsage["nativeUsage"])
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77) ``` 


in this code:

```java
  @GetMapping("/hello-response")
  public ChatResponse helloResponse(@RequestParam String prompt) {
    String promptFromDb = "Plan me a {days}-day trip to {city}";
    return chatClient
        .prompt()
        .user(u -> u.text(promptFromDb).param("days", 3).param("city", prompt))
        .call()
        .chatResponse();
  }

Environment
Java 25
Spring Boot 3.5
Spring AI 1.1.3
Amazon Bedrock Converse

Steps to reproduce
Execute above code.

Expected behavior
No exception is thrown like in Spring AI 1.1.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.