Fix error message on invalid field names for a struct variant

Fixes #19922.