How do I detect any block around an entity using the /execute command in Minecraft?

Solution 1:

Try the following:

/execute unless block X Y Z minecraft:air run SOMETHING...

Theoretically this should work, as minecraft:air is a block type, and should be detectable using the /execute command.