{"record":{"id":"456cbe8b591519fa","repo":"larksuite/cli","slug":"set-calendar-event-end-must-be-a-valid-iso-8601-t","errorCode":null,"errorMessage":"set_calendar: event_end must be a valid ISO 8601 timestamp","messagePattern":"set_calendar: event_end must be a valid ISO 8601 timestamp","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/model.go","lineNumber":359,"sourceCode":"\t\tif strings.TrimSpace(op.SignatureID) == \"\" {\n\t\t\treturn fmt.Errorf(\"insert_signature requires signature_id\")\n\t\t}\n\tcase \"remove_signature\":\n\t\t// No required fields.\n\tcase \"set_calendar\":\n\t\tif strings.TrimSpace(op.EventSummary) == \"\" {\n\t\t\treturn fmt.Errorf(\"set_calendar requires event_summary\")\n\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","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/model.go#L341-L377","documentation":"Same parse failure as error 840 but for the `event_end` field of a `set_calendar` operation: the value is non-empty yet parseISO8601 cannot match it against any of the four supported layouts (RFC 3339 with/without seconds, with/without timezone offset). The library validates both endpoints up front so a malformed event never reaches the calendar API.","triggerScenarios":"set_calendar op with event_end like '1725400000000' (epoch), '2026/09/04 11:00', '2026-09-04' (date-only), 'Fri Sep 04 2026 11:00:00 GMT+0800', or any string not matching one of the four time.Parse layouts in parseISO8601.","commonSituations":"Generating end times with a different formatter than start times; timezone libraries outputting offsets like '+08' (single-digit hours) instead of '+08:00'; serializing dates via fmt.Sprintf(\"%v\", t) which yields a full Go date string the parser rejects.","solutions":["Reformat event_end to RFC 3339, e.g. 2026-09-04T11:00:00Z or with explicit offset 2026-09-04T11:00:00+08:00","Convert epoch numbers first: time.Unix(sec).UTC().Format(time.RFC3339)","Check that event_start and event_end are produced by the same formatting code path — often one is fixed while the other still uses a legacy format","Pre-validate with time.Parse(time.RFC3339, s) client-side"],"exampleFix":"// before\nend := fmt.Sprintf(\"%v\", endTime) // \"2026-09-04 11:00:00 +0800 CST\"\n// after\nend := endTime.UTC().Format(time.RFC3339) // \"2026-09-04T03:00:00Z\"","handlingStrategy":"validation","validationCode":"func validTimestamp(s string) bool {\n    _, err := time.Parse(time.RFC3339, s)\n    return err == nil\n}\nif !validTimestamp(op.EventEnd) {\n    return fmt.Errorf(\"event_end must be RFC 3339, got %q\", op.EventEnd)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Format event_start and event_end with the same helper so one cannot drift out of spec","Avoid Go default time formatting (%v) or database timestamp strings as wire values","Convert epoch values explicitly with time.Unix(...).UTC().Format(time.RFC3339)","Validate end separately from start — errors are reported per field"],"tags":["validation","iso8601","calendar","draft-patch"],"backgroundTag":"invalid-timestamp-format","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"}