Describe the bug
On Aug. 12 around 19:20 UTC, one of our services (running in AKS) seemed to have a connection issue getting to our CosmosDB instance. We got errors while calling .saveAll() on a Spring Data Cosmos Repository on a collection of entities three times. While the application recovered the connection and later requests worked, there was an NullPointerException logged that at the very least made things a little confusing to figure out, and I think that without it, it might have automatically retried those specific data saves.
Exception or Stack Trace
2026-08-12T19:20:20.709Z WARN 1 --- [dispatch] [rntbd-epoll-3-4] .c.i.d.r.RntbdClientChannelHealthChecker : [id: 0x9734fd0f, L:/100.96.59.236:33428 - R:cdb-ms-prod-eastus2-be122.documents.azure.com/20.15.13.186:14142] health check failed due to transit timeout on write threshold hit: [rntbdContext: Optional[RntbdContext({"activityId":"3715933b-5ff5-4f87-910f-4ccb2ca5cc66","clientVersion":"","idleTimeoutInSeconds":120,"protocolVersion":0,"serverProperties":{"agent":"DocumentDB Server","version":" version=2.14.0.0"},"unauthenticatedTimeoutInSeconds":25,"statusCode":200})],lastChannelRead: 2026-08-12T19:20:04.312758445Z, transitTimeoutWriteCount: 1, timeoutOnWriteThreshold: 1, timeoutOnWriteTimeLimitInNanos: 6,000,000,000]clientVmId: uuid:acfda9ad-b196-42d3-b679-aab15d30aeec, clientUsedMemory: 644018 KB, clientAvailableMemory: 1453134 KB, clientSystemCpuLoad: (2026-08-12T19:19:52.045584431Z 21.5%), (2026-08-12T19:19:57.045598301Z 35.4%), (2026-08-12T19:20:02.045592776Z 30.2%), (2026-08-12T19:20:07.045591576Z 23.9%), (2026-08-12T19:20:12.045594423Z 15.4%), (2026-08-12T19:20:17.045587114Z 25.6%), clientAvailableProcessors: 2]
2026-08-12T19:20:20.710Z WARN 1 --- [dispatch] [rntbd-epoll-3-4] c.a.c.i.d.GoneAndRetryWithRetryPolicy : Operation will NOT be retried. Write operations which failed due to transient transport errors can not be retried safely when sending the request to the service because they aren't idempotent. Current attempt 1, Exception:
{"ClassName":"GoneException","userAgent":"azsdk-java-cosmos/4.79.0 Linux/5.15.0-1111-azure JRE/17.0.20","statusCode":410,"resourceAddress":"rntbd://cdb-ms-prod-eastus2-be122.documents.azure.com:14142/apps/96861dd2-ea69-4273-bb2c-446d5fadc16e/services/c6d579b9-537f-44a6-9978-2b85226bf347/partitions/9afedafd-54cf-4263-80e6-3187ce0c01c1/replicas/134243081869070243p/","innerErrorMessage":"ChannelHandlerContext(RntbdRequestManager#0, [id: 0x9734fd0f, L:/100.96.59.236:33428 - R:cdb-ms-prod-eastus2-be122.documents.azure.com/20.15.13.186:14142]) closed exceptionally with 1 pending requests","causeInfo":"[class: class com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdRequestManager$UnhealthyChannelException, message: health check failed, reason: [id: 0x9734fd0f, L:/100.96.59.236:33428 - R:cdb-ms-prod-eastus2-be122.documents.azure.com/20.15.13.186:14142] health check failed due to transit timeout on write threshold hit: [rntbdContext: Optional[RntbdContext({\"activityId\":\"3715933b-5ff5-4f87-910f-4ccb2ca5cc66\",\"clientVersion\":\"\",\"idleTimeoutInSeconds\":120,\"protocolVersion\":0,\"serverProperties\":{\"agent\":\"DocumentDB Server\",\"version\":\" version=2.14.0.0\"},\"unauthenticatedTimeoutInSeconds\":25,\"statusCode\":200})],lastChannelRead: 2026-08-12T19:20:04.312758445Z, transitTimeoutWriteCount: 1, timeoutOnWriteThreshold: 1, timeoutOnWriteTimeLimitInNanos: 6,000,000,000]clientVmId: uuid:acfda9ad-b196-42d3-b679-aab15d30aeec, clientUsedMemory: 644018 KB, clientAvailableMemory: 1453134 KB, clientSystemCpuLoad: (2026-08-12T19:19:52.045584431Z 21.5%), (2026-08-12T19:19:57.045598301Z 35.4%), (2026-08-12T19:20:02.045592776Z 30.2%), (2026-08-12T19:20:07.045591576Z 23.9%), (2026-08-12T19:20:12.045594423Z 15.4%), (2026-08-12T19:20:17.045587114Z 25.6%), clientAvailableProcessors: 2]]","responseHeaders":"{x-ms-substatus=0}","requestHeaders":"[x-ms-cosmos-batch-atomic=false, x-ms-cosmos-sdk-supportedcapabilities=1, Accept=application/json, x-ms-cosmos-is-batch-request=true, x-ms-date=Wed, 12 Aug 2026 19:20:19 GMT, x-ms-documentdb-collection-rid=Ha42AP+cbB4=, x-ms-documentdb-partitionkeyrangeid=0, x-ms-cosmos-batch-continue-on-error=true, x-ms-client-retry-attempt-count=0, x-ms-remaining-time-in-ms-on-client=60000, Content-Type=application/json]"}
at com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdRequestManager.completeAllPendingRequestsExceptionally(RntbdRequestManager.java:948) ~[azure-cosmos-4.79.0.jar!/:4.79.0]
at com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdRequestManager.exceptionCaught(RntbdRequestManager.java:343) ~[azure-cosmos-4.79.0.jar!/:4.79.0]
at com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdRequestManager.lambda$userEventTriggered$0(RntbdRequestManager.java:383) ~[azure-cosmos-4.79.0.jar!/:4.79.0]
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:604) ~[netty-common-4.1.135.Final.jar!/:4.1.135.Final]
…
Caused by: com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdRequestManager$UnhealthyChannelException: health check failed, reason: [id: 0x9734fd0f, L:/100.96.59.236:33428 - R:cdb-ms-prod-eastus2-be122.documents.azure.com/20.15.13.186:14142] health check failed due to transit timeout on write threshold hit: [rntbdContext: Optional[RntbdContext({"activityId":"3715933b-5ff5-4f87-910f-4ccb2ca5cc66","clientVersion":"","idleTimeoutInSeconds":120,"protocolVersion":0,"serverProperties":{"agent":"DocumentDB Server","version":" version=2.14.0.0"},"unauthenticatedTimeoutInSeconds":25,"statusCode":200})],lastChannelRead: 2026-08-12T19:20:04.312758445Z, transitTimeoutWriteCount: 1, timeoutOnWriteThreshold: 1, timeoutOnWriteTimeLimitInNanos: 6,000,000,000]clientVmId: uuid:acfda9ad-b196-42d3-b679-aab15d30aeec, clientUsedMemory: 644018 KB, clientAvailableMemory: 1453134 KB, clientSystemCpuLoad: (2026-08-12T19:19:52.045584431Z 21.5%), (2026-08-12T19:19:57.045598301Z 35.4%), (2026-08-12T19:20:02.045592776Z 30.2%), (2026-08-12T19:20:07.045591576Z 23.9%), (2026-08-12T19:20:12.045594423Z 15.4%), (2026-08-12T19:20:17.045587114Z 25.6%), clientAvailableProcessors: 2]
2026-08-12T19:20:20.710Z WARN 1 --- [dispatch] [rntbd-epoll-3-2] .c.i.d.r.RntbdClientChannelHealthChecker : [id: 0xee099cb0, L:/100.96.59.236:41392 - R:cdb-ms-prod-eastus2-be122.documents.azure.com/20.15.13.186:14142] health check failed due to transit timeout on write threshold hit: [rntbdContext: Optional[RntbdContext({"activityId":"d1d308a5-d71d-415e-a645-6d0534c663bd","clientVersion":"","idleTimeoutInSeconds":120,"protocolVersion":0,"serverProperties":{"agent":"DocumentDB Server","version":" version=2.14.0.0"},"unauthenticatedTimeoutInSeconds":25,"statusCode":200})],lastChannelRead: 2026-08-12T19:20:04.312309160Z, transitTimeoutWriteCount: 1, timeoutOnWriteThreshold: 1, timeoutOnWriteTimeLimitInNanos: 6,000,000,000]clientVmId: uuid:acfda9ad-b196-42d3-b679-aab15d30aeec, clientUsedMemory: 644018 KB, clientAvailableMemory: 1453134 KB, clientSystemCpuLoad: (2026-08-12T19:19:52.045584431Z 21.5%), (2026-08-12T19:19:57.045598301Z 35.4%), (2026-08-12T19:20:02.045592776Z 30.2%), (2026-08-12T19:20:07.045591576Z 23.9%), (2026-08-12T19:20:12.045594423Z 15.4%), (2026-08-12T19:20:17.045587114Z 25.6%), clientAvailableProcessors: 2]
2026-08-12T19:20:20.713Z INFO 1 --- [dispatch] [smos-parallel-5] c.a.c.implementation.batch.BulkExecutor : BulkExecutor.execute flux terminated - Signal: cancel - # left items 1, Context: BulkExecutor-38657[n/a], Thread[Name: spring-data-cosmos-parallel-5,Group: main, isDaemon: true, Id: 123]
…
2026-08-12T19:20:20.720Z ERROR 1 --- [dispatch] [smos-parallel-5] a.w.r.e.AbstractErrorWebExceptionHandler : [5245435c-2417817] 500 Server Error for HTTP POST "/api/external/routePlans/252430/2026-08-13/ddb55c56-1721-49ca-a907-59b5c683fb1a/moveStops"
java.lang.NullPointerException: Cannot invoke "com.azure.cosmos.models.CosmosBulkItemResponse.getCosmosDiagnostics()" because the return value of "com.azure.cosmos.models.CosmosBulkOperationResponse.getResponse()" is null
at com.azure.spring.data.cosmos.core.ReactiveCosmosTemplate.lambda$insertAll$2(ReactiveCosmosTemplate.java:557) ~[azure-spring-data-cosmos-6.3.0.jar!/:6.3.0]
To Reproduce
That certainly is the tricky part; I don't know how to reproduce a sporadic connection issue with Cosmos.
Code Snippet
While there's plenty of things before and after, the line that had the problem was
stopRepository.saveAll(newStops).collectList()
Expected behavior
No NullPointerException being logged while it worked on handling the temporary connection problem.
Setup (please complete the following information):
- OS: AKS, using Docker image
mcr.microsoft.com/openjdk/jdk:17-distroless, underlying Linux kernel 5.15.0-1111-azure
- IDE: IntelliJ IDEA Ultimate 2026.1.4
- Library/Libraries: azure-spring-data-cosmos 6.3.0
- App Server/Environment: AKS
- Frameworks: Spring Boot 3.5.16
Additional context
I think that it's trying to log information about the request, but since the request failed there wasn't actually an object to get data about.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
Describe the bug
On Aug. 12 around 19:20 UTC, one of our services (running in AKS) seemed to have a connection issue getting to our CosmosDB instance. We got errors while calling .saveAll() on a Spring Data Cosmos Repository on a collection of entities three times. While the application recovered the connection and later requests worked, there was an NullPointerException logged that at the very least made things a little confusing to figure out, and I think that without it, it might have automatically retried those specific data saves.
Exception or Stack Trace
…
…
To Reproduce
That certainly is the tricky part; I don't know how to reproduce a sporadic connection issue with Cosmos.
Code Snippet
While there's plenty of things before and after, the line that had the problem was
stopRepository.saveAll(newStops).collectList()Expected behavior
No NullPointerException being logged while it worked on handling the temporary connection problem.
Setup (please complete the following information):
mcr.microsoft.com/openjdk/jdk:17-distroless, underlying Linux kernel 5.15.0-1111-azureAdditional context
I think that it's trying to log information about the request, but since the request failed there wasn't actually an object to get data about.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report