{"record":{"id":"7f08a69f7e1fe7a1","repo":"larksuite/cli","slug":"s-requires-address","errorCode":null,"errorMessage":"%s requires address","messagePattern":"(.+?) requires address","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":285,"sourceCode":"\t\t}\n\t\tif strings.ContainsAny(op.Value, \"\\r\\n\") {\n\t\t\treturn fmt.Errorf(\"set_subject: value must not contain CR or LF\")\n\t\t}\n\tcase \"set_recipients\":\n\t\tif !isRecipientField(op.Field) {\n\t\t\treturn fmt.Errorf(\"recipient field must be one of to/cc/bcc\")\n\t\t}\n\t\tfor _, addr := range op.Addresses {\n\t\t\tif strings.TrimSpace(addr.Address) == \"\" {\n\t\t\t\treturn fmt.Errorf(\"set_recipients requires non-empty addresses\")\n\t\t\t}\n\t\t}\n\tcase \"add_recipient\", \"remove_recipient\":\n\t\tif !isRecipientField(op.Field) {\n\t\t\treturn fmt.Errorf(\"recipient field must be one of to/cc/bcc\")\n\t\t}\n\t\tif strings.TrimSpace(op.Address) == \"\" {\n\t\t\treturn fmt.Errorf(\"%s requires address\", op.Op)\n\t\t}\n\tcase \"set_reply_to\":\n\t\tif len(op.Addresses) == 0 {\n\t\t\treturn fmt.Errorf(\"set_reply_to requires addresses\")\n\t\t}\n\tcase \"clear_reply_to\":\n\tcase \"set_body\", \"set_reply_body\":\n\tcase \"replace_body\", \"append_body\":\n\t\tif !isBodyKind(op.BodyKind) {\n\t\t\treturn fmt.Errorf(\"body_kind must be text/plain or text/html\")\n\t\t}\n\t\tif op.Selector != \"\" && op.Selector != \"primary\" {\n\t\t\treturn fmt.Errorf(\"selector must be primary\")\n\t\t}\n\tcase \"set_header\":\n\t\tif strings.TrimSpace(op.Name) == \"\" {\n\t\t\treturn fmt.Errorf(\"set_header requires name\")\n\t\t}","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L267-L303","documentation":"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.","triggerScenarios":"{\"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.","commonSituations":"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.","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."],"exampleFix":"// before\n{\"op\":\"remove_recipient\",\"field\":\"to\",\"address\":\"\"}\n\n// after\n{\"op\":\"remove_recipient\",\"field\":\"to\",\"address\":\"old@example.com\"}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(op.Address) == \"\" {\n    return fmt.Errorf(\"%s needs an address\", op.Op)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["mail","validation","patch-op","recipients"],"backgroundTag":"empty-required-field","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}