{"record":{"id":"36681f38fe88567c","repo":"larksuite/cli","slug":"recipient-field-must-be-one-of-to-cc-bcc","errorCode":null,"errorMessage":"recipient field must be one of to/cc/bcc","messagePattern":"recipient field must be one of to/cc/bcc","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":273,"sourceCode":"\t\tif err := op.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid patch op #%d: %w\", i+1, err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (op PatchOp) Validate() error {\n\tswitch op.Op {\n\tcase \"set_subject\":\n\t\tif strings.TrimSpace(op.Value) == \"\" {\n\t\t\treturn fmt.Errorf(\"set_subject requires value\")\n\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\":","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L255-L291","documentation":"Guard in PatchOp.Validate: a set_recipients op names a field other than to/cc/bcc, the only recipient fields that can be set.","triggerScenarios":"Thrown at shortcuts/mail/draft/model.go:273 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use field to, cc, or bcc"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}