When you destroy a bed or comparator, their block entity isn't deleted but still exists in the world. If you then place a container in the same block, you are unable to access its inventory and even worse, placing a dropper/dispenser in the same block and activating it instantly crashes the game.
Steps to Reproduce:
1. Place a bed or comparator and then destroy it
2. You can verify that the block entity is still existent with the "/data get block" - command
3. Try one of the things described above
MC-123432 Snapshots are leaking tile entity data through to world save