How RigidPrim dynamically changes scale?

I have an RL task that needs to change the scale of DynamicCuboid according to the established strategy every time it starts. Since DynamicCuboid is a RigidPrim, I get the error[Error] [omni.physx.plugin] PhysX error: PxRigidActor::detachShape: shape is not attached to this actor!, FILE /buildAgent/work/74336105e89c4a74/source/ physx/src/NpRigidActorTemplate.h, LINE 262 , my code to change the scale of DynamicCuboid is "
for i in range(self.num_envs):
        prim_path=self.default_base_env_path + "/env
"+ str(i) + “/pick_cube”
        omni.usd.get_context().get_stage().RemovePrim(prim_path)
        position = self.pick_cubes_world_pos[i]
        position[2] = self.obs_buf[i][2] / 2.0 + 0.01
        self.picks[i] = DynamicCuboid(
                prim_path=prim_path,
                name=“picks” + str(i),
                position=position,
                size=1.0,
                color=np.array([0, 0, 1]),
                scale=self.obs_buf[i],
                orientation=self.ori_quat[0],
        )"
and my robot will also receive the error "Exception: Failed to get DOF positions from backend". Do you have any good suggestions? Thank you very much