Fix error message for invalid field names of a struct variant

Fixes #19922.