larksuite/cli · error
recipient field must be one of to/cc/bcc
Error message
recipient field must be one of to/cc/bcc
What it means
Guard in PatchOp.Validate: a set_recipients op names a field other than to/cc/bcc, the only recipient fields that can be set.
Source
Thrown at shortcuts/mail/draft/model.go:273
if err := op.Validate(); err != nil {
return fmt.Errorf("invalid patch op #%d: %w", i+1, err)
}
}
return nil
}
func (op PatchOp) Validate() error {
switch op.Op {
case "set_subject":
if strings.TrimSpace(op.Value) == "" {
return fmt.Errorf("set_subject requires value")
}
if strings.ContainsAny(op.Value, "\r\n") {
return fmt.Errorf("set_subject: value must not contain CR or LF")
}
case "set_recipients":
if !isRecipientField(op.Field) {
return fmt.Errorf("recipient field must be one of to/cc/bcc")
}
for _, addr := range op.Addresses {
if strings.TrimSpace(addr.Address) == "" {
return fmt.Errorf("set_recipients requires non-empty addresses")
}
}
case "add_recipient", "remove_recipient":
if !isRecipientField(op.Field) {
return fmt.Errorf("recipient field must be one of to/cc/bcc")
}
if strings.TrimSpace(op.Address) == "" {
return fmt.Errorf("%s requires address", op.Op)
}
case "set_reply_to":
if len(op.Addresses) == 0 {
return fmt.Errorf("set_reply_to requires addresses")
}
case "clear_reply_to":View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Use field to, cc, or bcc
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shortcuts/mail/draft/model.go:273 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/36681f38fe88567c.
Report an issue: GitHub.