/replaceitem wrongly reports "Block at pos(x,y,z) is not a container" when used on a barrel, and no item is placed.
How to reproduce
Run the following commands:
/setblock ~ ~2 ~ barrel
/replaceitem block ~ ~2 ~ slot.container 0 apple
→ Error message, apple is not placed in barrel.
Try again with a dropper or something and it works fine.