Fix error message on invalid field names for a struct variant

Fixes #19922.
it'd have been nice to have a test for this case as well.