lib/popcorn: fix serialization of validation errors