Fixed #17413 -- Serialization of form errors along with all metadata.

**Work in progress, not RFC.**

This branch builds on top of PR #1443, only the second commit is specific to this branch.