Lock Barrel UI

The following command works in game when I use it standing on top of the barrel

execute if items block ~ ~-1 ~ container.0 minecraft:structure_void[minecraft:custom_data={"tag":"trade_station_ui"}] run say hi

However, a similar command

execute if items block ~ ~ ~ container.0 minecraft:structure_void[minecraft:custom_data={"tag":"trade_station_ui"}] run say hi

put into set_grid.mcfunction, which 27 lines before that sets container.0 to exactly the above (and it does run). I also put it into resouce_trade_base/tick.mcfunction.

At this point nothing is working, I just want tick.mcfunction to detect when one of these goes missing (I did try execute unless as well, it still didnt work). Does anyone know how to get it to work?

Continue to help post