{"record":{"id":"5b159cb0843bc220","repo":"larksuite/cli","slug":"unsupported-op-q","errorCode":null,"errorMessage":"unsupported op %q","messagePattern":"unsupported op %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":367,"sourceCode":"\t\t}\n\t\tif strings.TrimSpace(op.EventStart) == \"\" || strings.TrimSpace(op.EventEnd) == \"\" {\n\t\t\treturn fmt.Errorf(\"set_calendar requires event_start and event_end\")\n\t\t}\n\t\tstart, err := parseISO8601(op.EventStart)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"set_calendar: event_start must be a valid ISO 8601 timestamp\")\n\t\t}\n\t\tend, err := parseISO8601(op.EventEnd)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"set_calendar: event_end must be a valid ISO 8601 timestamp\")\n\t\t}\n\t\tif !end.After(start) {\n\t\t\treturn fmt.Errorf(\"set_calendar: event_end must be after event_start\")\n\t\t}\n\tcase \"remove_calendar\":\n\t\t// No required fields.\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported op %q\", op.Op)\n\t}\n\treturn nil\n}\n\nfunc isRecipientField(field string) bool {\n\tswitch strings.ToLower(strings.TrimSpace(field)) {\n\tcase \"to\", \"cc\", \"bcc\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc isBodyKind(kind string) bool {\n\tswitch strings.ToLower(strings.TrimSpace(kind)) {\n\tcase \"text/plain\", \"text/html\":\n\t\treturn true\n\tdefault:","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L349-L385","documentation":"The draft patch validator switches on op.Op and only recognizes the ops defined in the switch (set_header, remove_header, add_attachment, add_inline, set_calendar, remove_calendar, etc.). Any other string — including typos, wrong casing, or ops from a different command — hits the default branch and is rejected. The offending op name is quoted in the message.","triggerScenarios":"Submitting a Patch whose op.Op is a typo (\"set_calender\", \"setCalendar\"), capitalized (\"Set_Calendar\"), or a made-up op name; passing JSON op objects with an 'op' field the CLI does not implement.","commonSituations":"Hand-written op scripts with typos; docs or blog snippets referencing an older/newer op set; case-sensitivity mistakes; reusing ops from another shortcut domain in a mail draft patch.","solutions":["Run lark-cli with --help or schema on the draft patch command to list the supported op names","Match the op string exactly, lowercase with underscores (e.g. \"set_calendar\", not \"setCalendar\" or \"set_calender\")","Check for typos like transposed letters (calender vs calendar)","If the op genuinely does not exist, use the generic API command to call the endpoint directly instead of inventing an op"],"exampleFix":"// before\n{\"op\": \"set_calender\", \"event_summary\": \"Sync\", ...}\n// after\n{\"op\": \"set_calendar\", \"event_summary\": \"Sync\", ...}","handlingStrategy":"validation","validationCode":"var supportedOps = map[string]bool{\n    \"set_header\": true, \"remove_header\": true, \"add_attachment\": true,\n    \"add_inline\": true, \"replace_inline\": true, \"remove_inline\": true,\n    \"insert_signature\": true, \"remove_signature\": true,\n    \"set_calendar\": true, \"remove_calendar\": true,\n}\nif !supportedOps[op.Op] {\n    return fmt.Errorf(\"unknown op %q\", op.Op)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep op names in a shared constant list or enum rather than inline literals","Check `lark-cli ... --help` / `schema` output for the exact op vocabulary before scripting","Beware of typos (calender) and casing variants — ops are matched case-sensitively","Do not invent ops; fall back to the generic API command for unmodeled endpoints"],"tags":["validation","draft-patch","unknown-value","typo"],"backgroundTag":"invalid-enum-value","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"}