diff --git a/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java b/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java index 704c5883c2e34..c23d5ca8907e3 100644 --- a/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java +++ b/server/src/main/java/org/opensearch/action/support/replication/TransportReplicationAction.java @@ -241,7 +241,9 @@ protected TransportReplicationAction( ) { super(actionName, actionFilters, transportService.getTaskManager()); this.threadPool = threadPool; - this.tcWrapper = InternalThreadContextWrapper.from(threadPool.getThreadContext()); + if (threadPool != null) { + this.tcWrapper = InternalThreadContextWrapper.from(threadPool.getThreadContext()); + } this.transportService = transportService; this.clusterService = clusterService; this.indicesService = indicesService;