{"record":{"id":"f87a1aa19ba008aa","repo":"kataras/iris","slug":"invalid-offset-minutes-d-s","errorCode":null,"errorMessage":"invalid offset minutes: %d: %s","messagePattern":"invalid offset minutes: (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"x/jsonx/iso8601.go","lineNumber":249,"sourceCode":"\tif len(offsetParts) != 3 {\n\t\treturn time.Time{}, fmt.Errorf(\"invalid offset format: %s\", offset)\n\t}\n\n\thours, err := strconv.Atoi(offsetParts[0])\n\tif err != nil {\n\t\treturn time.Time{}, fmt.Errorf(\"error parsing offset hours: %s: %w\", offset, err)\n\t}\n\n\tif hours > 24 {\n\t\treturn time.Time{}, fmt.Errorf(\"invalid offset hours: %d: %s\", hours, offset)\n\t}\n\n\tminutes, err := strconv.Atoi(offsetParts[1])\n\tif err != nil {\n\t\treturn time.Time{}, fmt.Errorf(\"error parsing offset minutes: %s: %w\", offset, err)\n\t}\n\tif minutes > 60 {\n\t\treturn time.Time{}, fmt.Errorf(\"invalid offset minutes: %d: %s\", minutes, offset)\n\t}\n\n\tseconds, err := strconv.Atoi(offsetParts[2])\n\tif err != nil {\n\t\treturn time.Time{}, fmt.Errorf(\"error parsing offset seconds: %s: %w\", offset, err)\n\t}\n\n\tif seconds > 60 {\n\t\treturn time.Time{}, fmt.Errorf(\"invalid offset seconds: %d: %s\", seconds, offset)\n\t}\n\n\ttotalOffset := time.Duration(sign) * (time.Duration(hours)*time.Hour + time.Duration(minutes)*time.Minute + time.Duration(seconds)*time.Second)\n\treturn t.Add(-totalOffset), nil\n}\n\n// UnmarshalJSON parses the \"b\" into ISO8601 time.\nfunc (t *ISO8601) UnmarshalJSON(b []byte) error {\n\tif len(b) == 0 {","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/x/jsonx/iso8601.go#L231-L267","documentation":"After parsing the minutes of an unconventional '+HH:MM:SS' offset, adjustForUnconventionalOffset rejects minute values greater than 60. A real timezone offset never has more than 59 minutes (60 is tolerated here as an edge case), so larger values indicate a malformed offset.","triggerScenarios":"ParseISO8601 on a timestamp with an offset like '+03:90:00' — minutes parse as an integer but exceed 60.","commonSituations":"Buggy serializers concatenating minutes and seconds (e.g. '3059' split wrongly); hand-built offset strings; corrupted data imports.","solutions":["Correct the offset so minutes are within 0–59 (e.g. '+03:59:00').","Check the producer for field-order or width bugs when composing the offset string.","Validate offsets at ingestion with a regex before parsing (e.g. ^[+-]\\d{1,2}:[0-5]\\d:[0-5]\\d$)."],"exampleFix":"// before\nParseISO8601(\"2024-01-02T15:04:05+03:90:00\") // invalid offset minutes: 90\n// after\nParseISO8601(\"2024-01-02T15:04:05+03:30:00\")","handlingStrategy":"validation","validationCode":"func offsetMinutesInRange(ts string) bool {\n\ti := strings.LastIndexAny(ts, \"+-\")\n\tif i < 0 { return false }\n\tparts := strings.Split(ts[i+1:], \":\")\n\tif len(parts) != 3 { return false }\n\tm, err := strconv.Atoi(parts[1])\n\treturn err == nil && m >= 0 && m <= 59\n}","typeGuard":null,"tryCatchPattern":"tt, err := jsonx.ParseISO8601(s)\nif err != nil {\n\tif strings.Contains(err.Error(), \"invalid offset minutes\") {\n\t\treturn fmt.Errorf(\"timestamp %q has out-of-range offset minutes\", s)\n\t}\n\treturn err\n}","preventionTips":["Validate offset minutes are 00–59 before parsing.","Watch for concatenation bugs in custom serializers.","Prefer standard +HH:MM offsets that avoid this code path."],"tags":["time-parsing","iso8601","timezone-offset","range-check"],"backgroundTag":"invalid-timezone-offset-format","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}