CCR stopped working after 3 days, what can I do?

OpenSearch 2.4 (running in docker)

I am trying to use CCR autofollow, to replicate indices. After around 3 days the replication seemingly stopped working and I can’t figure out why. I tried deleting and recreating the autofollow rule, but it did not resolve the issue. I tried to start replication manually for an index that should be replicated by the autofollow rule and I get this response:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "uninitialized_property_access_exception",
        "reason" : "lateinit property leaderIndex has not been initialized"
      }
    ],
    "type" : "uninitialized_property_access_exception",
    "reason" : "lateinit property leaderIndex has not been initialized"
  },
  "status" : 500
}

Any ideas? What should I be looking for?

(Btw, I am deleting replicated indices with a script after they leader dosen’t exist anymore, I guess this should not cause problems, as this happens through OpenSearch API)

Edit: the “lateinit property leaderIndex has not been initialized” problem was my fault, I accidentally left the body of the API call empty and that caused this error. So I am able to start replication by hand. The auto follow is not working tho.

Can you verify whether the autofollow task is running correctly by following the below steps:

  • Run the _tasks API to check whether the autofollow task is running
_cat/tasks?v&actions=cluster:admin/plugins/replication/autofollow\[c\]&detailed
  • Run the autofollow_stats API and check whether the last_execution_time in the response is recent.

If the above checks confirm that autofollow task is running then looking into the logs to see any error in starting replication through autofollow.