What happens when Daern’s Instant Fortress expands into a space that’s too small?

Daern’s Instant Fortress (DMG 160) is ordinarily a 1-inch metal cube, but rapidly grows into a 20x20x30 ft fortress when activated, dealing 10d10 bludgeoning damage to anything in its way.

What if the 10d10 damage is not enough to clear its space? For example, what would happen if a player tried to activate the Fortress deep inside a small cave? Would the item fail to activate, or would it take damage/be destroyed, or would it burst through the walls of the cave?

While this question is specifically about the Instant Fortress, I’m also interested about a general rule for this circumstance. Some items, like the Figurines of Wondrous Power, have an explicit restriction on changing size in enclosed spaces, whereas others, like the Staff of the Woodlands, do not. Is there a general way to reconcile these inconsistencies, or do I just have to make a ruling?