Xmsim *E covits same instance name

Currently my code is like this

class mesh_ior_msg_cov;

covergroup mesh_cmd_cg;
endgroup

covergroup mesh_cmd_cg;
endgroup

covergroup mesh_cmd_cg;
endgroup

function new(string name = "mesh_ior_msg_cov");
    this.name=name;
    mesh_cmd_cg         = new();
    mesh_rsp3_cg        = new();
    mesh_cache_data_cg  = new();
    row_cfg             = new();
endfunction : new

endclass

function msg_cov_sample(mesh_ior_transaction txn);
    mesh_ior_cmd_transaction  cmd_txn;
    mesh_ior_rsp3_transaction rsp3_txn;
    mesh_ior_data_transaction data_txn;

    if (txn == null) begin
    end else if ($cast(cmd_txn, txn)) begin
      mesh_cmd_cg.sample(cmd_txn);
    end else if ($cast(rsp3_txn, txn)) begin
      mesh_rsp3_cg.sample(rsp3_txn);
    end else if ($cast(data_txn, txn)) begin
      mesh_cache_data_cg.sample(data_txn);
    end
    else begin
      //`uvm_fatal(get_type_name(),"DO NOTHING")
    end

  endfunction : msg_cov_sample

class cov_monitor extends uvm_monitor;
 function new(string name="cov_monitor",uvm_component parent=null);
    super.new(name, parent);

    for(int i=0;i<16;i++)
    begin
      msg_cov[i]=new($sformatf("mesh_ior_msg_cov[%0d]",i));
    end
  endfunction : new

function void write_ch_msg_imp (mesh_ior_transaction txn);
    
    msg_cov[0].msg_cov_sample(txn);

  endfunction : write_ch_msg_imp
endclass

I’m getting below error

xmsim: *e,covits: covergroup instance mesh_cache_data_cg with ‘mesh_cache_data_cg’ as the instance name will not be saved to the database and its coverage will be merged with another covergroup instance mesh_cache_data_cg with the same instance name ‘mesh_cache_data_cg’. this is because both the covergroup instances are having same description and are defined in the same scope with the same name.

please help

In reply to Raja VA:

You made a lot of errors copy/pssting this code. Try recreating this as a standalone example without using UVM, and only use the code in constructing the covergreoup, the sampling is not needed to reproduce the error.