The Issue can be recreated when you type this in chat:
It doesn't matter if another container (dropper with contents) is going to be replaced, or if there's just air, the Error-Message is always as follows:
An unexpected error occurred while executing that command
I only stumbled across this issue when I tried to update a function of mine, a Blast Furnace Function. I don't know if it's totally relevant, but I figured I link this just in case. So, basically, there are two problems occuring:
- The hopper is supposed to replace a dropper without it dropping its contents. That's what the "replace" functionality is for. The contents dropped anyway.
- And the hopper wasn't named.
There is different behaviour wether the commands are being run from the functions or from typing in chat. The dropping of contents doesn't occur if the player is execting the setblock command from chat.