larksuite/cli · error
%s requires address
Error message
%s requires address
What it means
Thrown by PatchOp.Validate() in shortcuts/mail/draft/model.go:285 for add_recipient or remove_recipient ops whose op.Address is empty or whitespace-only. The message interpolates the op name (e.g. "add_recipient requires address"). These ops mutate exactly one recipient, so an address is mandatory.
Source
Thrown at shortcuts/mail/draft/model.go:285
}
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":
case "set_body", "set_reply_body":
case "replace_body", "append_body":
if !isBodyKind(op.BodyKind) {
return fmt.Errorf("body_kind must be text/plain or text/html")
}
if op.Selector != "" && op.Selector != "primary" {
return fmt.Errorf("selector must be primary")
}
case "set_header":
if strings.TrimSpace(op.Name) == "" {
return fmt.Errorf("set_header requires name")
}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Provide the full address string in op.Address for the add_recipient/remove_recipient op.
- Verify the variable feeding Address is populated before constructing the op.
- To clear all recipients of a field, use set_recipients with an empty addresses array context per your workflow instead of a blank remove_recipient.
Example fix
// before
{"op":"remove_recipient","field":"to","address":""}
// after
{"op":"remove_recipient","field":"to","address":"old@example.com"} Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(op.Address) == "" {
return fmt.Errorf("%s needs an address", op.Op)
} Prevention
- Check the source variable is non-empty before constructing add_recipient/remove_recipient ops.
- Never pass an empty address expecting wildcard removal — remove_recipient matches exact addresses.
- Wrap op construction in a helper that rejects blank address strings.
When it happens
Trigger: {"op":"add_recipient","field":"to"} with no address key, address:"", or address:" "; building the op from a variable that was empty; JSON where address was omitted because it was empty with omitempty semantics.
Common situations: Variables holding the recipient left unset after failed parsing; removing a recipient by passing an empty address hoping it matches all; template engines substituting an empty string for a missing placeholder.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- set_recipients requires non-empty addresses
- set_reply_to requires addresses
- body_kind must be text/plain or text/html
- selector must be primary
- set_header requires name
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/7f08a69f7e1fe7a1.
Report an issue: GitHub.