Extract a specific error type with errors.As:
var ve ValidationError
if errors.As(err, &ve) {
fmt.Println("Invalid field:", ve.Field)
}
errors.As searches the error chain for a matching type. If found, it sets your variable and returns true. This is safer than type assertions.