{"record":{"id":"350d14eadeeaeeca","repo":"larksuite/cli","slug":"set-reply-to-requires-addresses","errorCode":null,"errorMessage":"set_reply_to requires addresses","messagePattern":"set_reply_to requires addresses","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":289,"sourceCode":"\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}\n\t\tif strings.ContainsAny(op.Name, \":\\r\\n\") {\n\t\t\treturn fmt.Errorf(\"set_header: header name must not contain ':', CR, or LF\")\n\t\t}\n\t\tif strings.ContainsAny(op.Value, \"\\r\\n\") {","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L271-L307","documentation":"Thrown by PatchOp.Validate() in shortcuts/mail/draft/model.go:289 when a set_reply_to op is given an empty Addresses array. Setting Reply-To replaces the whole list, so at least one address is required; use clear_reply_to if the goal is to remove Reply-To entirely.","triggerScenarios":"{\"op\":\"set_reply_to\",\"addresses\":[]} or op built with Addresses left nil; clearing the slice programmatically before calling Validate.","commonSituations":"Code paths that build a shared addresses slice and pass it empty; attempting to unset Reply-To with set_reply_to instead of clear_reply_to; JSON produced by serializing a struct whose slice was never appended to (omitempty drops the key, yielding an empty/nil slice).","solutions":["Add at least one entry to the addresses array of the set_reply_to op.","If the intent is to remove Reply-To, use the clear_reply_to op, which validates as a no-op.","Guard the slice length before constructing the op if it may be empty."],"exampleFix":"// before\n{\"op\":\"set_reply_to\",\"addresses\":[]}\n\n// after\n{\"op\":\"set_reply_to\",\"addresses\":[{\"address\":\"support@example.com\"}]}\n// or to remove Reply-To:\n{\"op\":\"clear_reply_to\"}","handlingStrategy":"validation","validationCode":"if len(op.Addresses) == 0 {\n    return fmt.Errorf(\"set_reply_to needs at least one address\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use clear_reply_to (not an empty set_reply_to) to remove Reply-To.","Guard the addresses slice length before emitting the op.","Keep reply-to addresses in a dedicated variable so an unrelated empty list isn't reused."],"tags":["mail","validation","patch-op","reply-to"],"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"}