# rpc错误：代码=无效参数 描述=无效字段：name：值为空，必须是非空字符串

- **ID:** `go/grpc-invalid-argument-missing-field`
- **领域:** go
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端发送的protobuf消息中必填字段为空或无效，违反了服务器端验证规则。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.22 | active | — | — |
| 1.23 | active | — | — |

## 解决方案

1. **Validate all required fields before sending the RPC.** (95% 成功率)
   ```
   if req.Name == "" { return errors.New("name must not be empty") }
resp, err := client.CreateUser(ctx, req)
   ```
2. **Use protovalidate library to enforce constraints client-side.** (90% 成功率)
   ```
   import "github.com/bufbuild/protovalidate-go"
validator, _ := protovalidate.New()
if err := validator.Validate(req); err != nil { return err }
   ```

## 无效尝试

- **Ignoring the error and resending the same message.** — The message is still invalid; error will repeat. (100% 失败率)
- **Setting the field to a random non-empty string without understanding the requirement.** — May cause data corruption or further validation errors. (80% 失败率)
