Adding new mib as snmpgw is breaking the upgrade of the system

I’m trying to add UCD-SNMP-MIB, which is standard mib as snmpgw, but when I upgrade the system it throws below error

CDB: Upgrade failed: Upgrade transaction failed to validate: /confd_dyncfg:confdConfig: The module UCD-SNMP-MIB is compiled as a snmpgw module, but no agent is configured to implement it.

Only solution to this is clearing the cdb i.e. factory-default upgrade. Is there a way to fix this ?