{"record":{"id":"f19e5434aa2d6f1d","repo":"larksuite/cli","slug":"set-subject-requires-value","errorCode":null,"errorMessage":"set_subject requires value","messagePattern":"set_subject requires value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":266,"sourceCode":"}\n\nfunc (p Patch) Validate() error {\n\tif len(p.Ops) == 0 {\n\t\treturn fmt.Errorf(\"patch ops is required\")\n\t}\n\tfor i, op := range p.Ops {\n\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) == \"\" {","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L248-L284","documentation":"Guard in PatchOp.Validate: a set_subject op has an empty or whitespace-only value; a subject replacement requires non-empty text.","triggerScenarios":"Thrown at shortcuts/mail/draft/model.go:266 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty subject"],"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"}