Trial spawner cannot be activated in peaceful mode, even if a passive mob spawn egg is used on it. When switching from another difficulty to peaceful, the spawner instantly deactivates.
This behaviour is different from normal spawners, in which passive mobs can spawn from a spawner regardless of difficulty (as long as the spawning conditions are satisfied).
I am not sure if this is intentional or is just a bug.
Linked issues
Comments 2
This bug was improperly fixed - the new bug report can be found here: MC-278006
Confirmed, However I also am also unsure if trial spawners should work in peaceful mode. What happens is the mob is still in the trial spawner, but the spawner is inactive and does not display the mob. If you switch to any other difficulty it should be working fine.
I'll link a video of me performing the bug/ intentional feature: https://youtu.be/IRiY9uzrpL4
How to perform bug
1: Create a new world with cheats enabled
2: If it isn't already, set the difficulty to normal with /difficulty normal
3: place down a trial spawner
4: place a mob egg in it (any kind that will spawn, the hostility of the mob does not matter). the spawner will work normally
5: set the difficulty to peaceful with /difficulty peaceful
6: the trial spawner will deactivate and not show a mob, however it is still "working" because the mob is inside it but not shown
7: set the difficulty to normal with /difficulty normal. the trial spawner will work again with the same mob that you used for it earlier
8: break the trial spawner and place a new one without any entities in it
9: set the difficulty to peaceful with /difficulty peaceful
10: Right click the spawner with spawn egg (again, hostility does not matter). The mob is there but not displayed
11: set the difficulty to normal with /difficulty normal. the trial spawner will work normally and spawn the mob that you put in it while you were in peaceful
Notes
I have used normal difficulty as an example, however it will still work if you use hard/easy difficulty instead.