Describe the bug
When using the OpenTelemetry Java agent together with the AWS SDK v2 Bedrock Runtime, every BedrockRuntimeAsyncClient.converseStream(...) call that produces a tool use with empty input fails: the streaming subscription is cancelled and the returned CompletableFuture completes exceptionally.
This happens consistently whenever the LLM decides to invoke a tool that has no required parameters (or whose only parameters are optional and the model chooses not to pass them). Tool calls that include at least one argument work fine, and the rest of the conversation works fine until such a parameterless tool call is produced.
Workarounds that point at the AWS SDK instrumentation as the cause:
- Removing the
-javaagent:opentelemetry-javaagent.jar flag entirely → issue gone.
- Setting
OTEL_INSTRUMENTATION_AWS_SDK_ENABLED=false → issue gone.
- Adding a
required = true parameter to the affected tool so the model always emits a non-empty input → issue gone.
We need the AWS SDK instrumentation enabled, so the last two options are not viable workarounds for us in production.
Steps to reproduce
- Spring Boot application running on Eclipse Temurin 17 with the OpenTelemetry Java agent attached via
JAVA_TOOL_OPTIONS="-javaagent:/otel/opentelemetry-javaagent.jar".
- Use Spring AI's
BedrockProxyChatModel (which under the hood calls BedrockRuntimeAsyncClient.converseStream) against a Bedrock model that supports tool use (reproduced with Anthropic Claude 3.5 Sonnet and Amazon Nova Pro).
- Register at least one tool with no required parameters, for example:
@Tool(description = "Get the current date and time in ISO-8601 format")
public String currentDateTimeIso() {
return OffsetDateTime.now().toString();
}
- Send a prompt that makes the model want to call that tool (e.g. "What time is it now?").
- The streaming call fails. With the javaagent disabled, or with OTEL_INSTRUMENTATION_AWS_SDK_ENABLED=false, the very same prompt completes successfully and the tool result is returned.
Reproduces on every javaagent version we tested, from v2.15.0 up to and including v2.27.0.
Expected behavior
A converseStream call where the model emits a tool use content block with empty or missing input should complete normally, exactly as it does when the javaagent is not attached.
Actual behavior
The converseStream call fails: the Reactive Streams subscription is cancelled and the returned CompletableFuture completes exceptionally. The caller sees the whole assistant turn fail; subsequent retries with the same prompt fail in the same way.
Javaagent or library instrumentation version
v2.27.0 (also reproduced on every release we tested down to v2.15.0)
Environment
JDK: Eclipse Temurin 17 (eclipse-temurin:17-jre-jammy)
OS: Ubuntu 22.04 (container)
- Spring Boot 3.x
- Spring AI 2.0.0-M4 (
spring-ai-bedrock-converse, BedrockProxyChatModel)
- AWS SDK for Java v2, BOM 2.41.22, using
BedrockRuntimeAsyncClient with the Netty NIO async HTTP client
- OpenTelemetry Java agent attached via
JAVA_TOOL_OPTIONS="-javaagent:/otel/opentelemetry-javaagent.jar", otherwise default configuration
- Models used on Bedrock: Anthropic Claude 3.5 Sonnet and Amazon Nova Pro
Additional context
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Describe the bug
When using the OpenTelemetry Java agent together with the AWS SDK v2 Bedrock Runtime, every
BedrockRuntimeAsyncClient.converseStream(...)call that produces a tool use with empty input fails: the streaming subscription is cancelled and the returnedCompletableFuturecompletes exceptionally.This happens consistently whenever the LLM decides to invoke a tool that has no required parameters (or whose only parameters are optional and the model chooses not to pass them). Tool calls that include at least one argument work fine, and the rest of the conversation works fine until such a parameterless tool call is produced.
Workarounds that point at the AWS SDK instrumentation as the cause:
-javaagent:opentelemetry-javaagent.jarflag entirely → issue gone.OTEL_INSTRUMENTATION_AWS_SDK_ENABLED=false→ issue gone.required = trueparameter to the affected tool so the model always emits a non-empty input → issue gone.We need the AWS SDK instrumentation enabled, so the last two options are not viable workarounds for us in production.
Steps to reproduce
JAVA_TOOL_OPTIONS="-javaagent:/otel/opentelemetry-javaagent.jar".BedrockProxyChatModel(which under the hood callsBedrockRuntimeAsyncClient.converseStream) against a Bedrock model that supports tool use (reproduced with Anthropic Claude 3.5 Sonnet and Amazon Nova Pro).Reproduces on every javaagent version we tested, from v2.15.0 up to and including v2.27.0.
Expected behavior
A
converseStreamcall where the model emits a tool use content block with empty or missing input should complete normally, exactly as it does when the javaagent is not attached.Actual behavior
The
converseStreamcall fails: the Reactive Streams subscription is cancelled and the returnedCompletableFuturecompletes exceptionally. The caller sees the whole assistant turn fail; subsequent retries with the same prompt fail in the same way.Javaagent or library instrumentation version
v2.27.0 (also reproduced on every release we tested down to v2.15.0)
Environment
JDK: Eclipse Temurin 17 (eclipse-temurin:17-jre-jammy)
OS: Ubuntu 22.04 (container)
spring-ai-bedrock-converse,BedrockProxyChatModel)BedrockRuntimeAsyncClientwith the Netty NIO async HTTP clientJAVA_TOOL_OPTIONS="-javaagent:/otel/opentelemetry-javaagent.jar", otherwise default configurationAdditional context
converseStreamsubscription gets cancelled when the AWS SDK instrumentation is active).Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.