When I was playing and viewing the command updates, I saw an bug if I wrote "/execute at @r if block ~ ~ -2 ~ minecraft: diamond_block run attribute @a minecraft:generic.max_health base set 40" then the command will not work, but if I change @a to @p everything will work.