Config db fatal isssue

I’m facing a UVM_FATAL during the build_phase when the reg_agent tries to fetch its configuration object from the UVM config database.
Below are the code snippets I’m using and the corresponding simulation log.

In Environment (Setting the config)

// ahb_basic_env.sv - Inside build_phase
uvm_config_db#(reg_agent_config)::set(null, “*”, “reg_agent_config”, reg_cfg);

if (reg_cfg == null) begin
uvm_error("CFGDB_SET_ERR", "reg_agent_config object is null after set") end else begin uvm_info(“CFGDB_SET_OK”,
$sformatf(“reg_agent_config object set with name %s”, reg_cfg.get_name()),
UVM_LOW)
end

Log output confirms the set:

UVM_INFO ../../testbench/uvm/env/ahb5_env/ahb_basic_env.sv(74) @ 0: uvm_test_top.env [CFGDB_SET_OK]
reg_agent_config object set with name reg_cfg

In Agent (Getting the config)

// reg_agent.sv - Inside build_phase

// Get the configuration object from config_db
if (!uvm_config_db#(reg_agent_config)::get(this, “”, “reg_agent_config”, m_cfg))
if (m_cfg == null)
`uvm_fatal(“reg_agent_config”, “cant find object”);

`uvm_fatal(“CONFIG”, “Cannot get config object from uvm_config_db.”)

Simulation Log Output

UVM_WARNING @ 0: reporter [TPRGED] Type name ‘reg_agent_config’ already registered with factory.
UVM_INFO ../../testbench/uvm/env/ahb5_env/ahb_basic_env.sv(74) @ 0: uvm_test_top.env [CFGDB_SET_OK]
reg_agent_config object set with name reg_cfg
UVM_FATAL ../../testbench/uvm/env/reg_env/reg_agent.sv(43) @ 0:
uvm_test_top.env.reg_agenth [reg_agent_config] cant find object

It looks like the reg_agent is unable to retrieve the reg_agent_config object even though I’m setting it in the environment using "*" as the path.

Could someone please help me check if I might be missing something related to:

  1. The order of uvm_config_db::set() vs. agent creation in the environment?

  2. Whether I should use a more specific instance path like "reg_agenth" instead of "*"?

  3. The [TPRGED] warning — could multiple factory registrations of reg_agent_config affect the config_db lookup?

It is difficult to determine the issue based on the code you have posted. It would be beneficial if you can post a complete example which demonstrates your issue.