Minecraft / execute if block does not work with command blocks?

Ro
1

I'm currently in the process of programming a data pack that gives you jumpboost if you e.g. On a certain block you read… "/ execute as @a if block ~ ~ -1 ~ minecraft: gold_block run effect give @s minecraft: jump_boost 1 2" this command works only if you execute it as a player. But if you enter it in a repeating command block then the command no longer works and nothing happens. (Java 1.16.4)

Po

This is how the command works in command blocks:

/ execute as @a at @s if block ~ ~ -1 ~ minecraft: gold_block run effect give @s minecraft: jump_boost 1 2