larksuite/cli · error
patch ops is required
Error message
patch ops is required
What it means
Guard in Patch.Validate: the patch contains zero ops; a mail draft patch must perform at least one operation.
Source
Thrown at shortcuts/mail/draft/model.go:252
// CalendarICS holds the pre-built RFC 5545 ICS blob for a set_calendar
// op. Populated by the shortcut layer after the snapshot is parsed and
// organizer/attendee addresses can be resolved. Not serialised.
CalendarICS []byte `json:"-"`
}
// SignatureImage holds pre-downloaded image data for signature inline images.
// Populated by the shortcut layer, consumed by the patch layer.
type SignatureImage struct {
CID string
ContentType string
FileName string
Data []byte
}
func (p Patch) Validate() error {
if len(p.Ops) == 0 {
return fmt.Errorf("patch ops is required")
}
for i, op := range p.Ops {
if err := op.Validate(); err != nil {
return fmt.Errorf("invalid patch op #%d: %w", i+1, err)
}
}
return nil
}
func (op PatchOp) Validate() error {
switch op.Op {
case "set_subject":
if strings.TrimSpace(op.Value) == "" {
return fmt.Errorf("set_subject requires value")
}
if strings.ContainsAny(op.Value, "\r\n") {
return fmt.Errorf("set_subject: value must not contain CR or LF")
}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Include at least one patch op
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shortcuts/mail/draft/model.go:252 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/27d6282584c7eec2.
Report an issue: GitHub.