{"record":{"id":"f4c8528f9c092df3","repo":"apache/cassandra","slug":"minute-out-of-bounds","errorCode":null,"errorMessage":"Minute out of bounds.","messagePattern":"Minute out of bounds\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/functions/types/ParseUtils.java","lineNumber":414,"sourceCode":"        String formatError = \"Timestamp format must be hh:mm:ss[.fffffffff]\";\n        String zeros = \"000000000\";\n\n        if (str == null) throw new IllegalArgumentException(formatError);\n        str = str.trim();\n\n        // Parse the time\n        int firstColon = str.indexOf(':');\n        int secondColon = str.indexOf(':', firstColon + 1);\n\n        // Convert the time; default missing nanos\n        if (firstColon > 0 && secondColon > 0 && secondColon < str.length() - 1)\n        {\n            int period = str.indexOf('.', secondColon + 1);\n            hour = Integer.parseInt(str.substring(0, firstColon));\n            if (hour < 0 || hour >= 24) throw new IllegalArgumentException(\"Hour out of bounds.\");\n\n            minute = Integer.parseInt(str.substring(firstColon + 1, secondColon));\n            if (minute < 0 || minute >= 60) throw new IllegalArgumentException(\"Minute out of bounds.\");\n\n            if (period > 0 && period < str.length() - 1)\n            {\n                second = Integer.parseInt(str.substring(secondColon + 1, period));\n                if (second < 0 || second >= 60) throw new IllegalArgumentException(\"Second out of bounds.\");\n\n                nanos_s = str.substring(period + 1);\n                if (nanos_s.length() > 9) throw new IllegalArgumentException(formatError);\n                if (!Character.isDigit(nanos_s.charAt(0))) throw new IllegalArgumentException(formatError);\n                nanos_s = nanos_s + zeros.substring(0, 9 - nanos_s.length());\n                a_nanos = Integer.parseInt(nanos_s);\n            }\n            else if (period > 0) throw new ParseException(formatError, -1);\n            else\n            {\n                second = Integer.parseInt(str.substring(secondColon + 1));\n                if (second < 0 || second >= 60) throw new ParseException(\"Second out of bounds.\", -1);\n            }","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/functions/types/ParseUtils.java#L396-L432","documentation":"parseTime validated the minute component of the time string and found it outside the valid range 0-59. CQL `time` values must be a real time of day, so minutes of 60+ (or negative) are rejected with this IllegalArgumentException.","triggerScenarios":"Calling ParseUtils.parseTime(\"12:60:00\"), \"10:75:30\", or any string whose substring between the first and second colon parses to an int outside [0, 59].","commonSituations":"Accumulated/rounded minute values (e.g. 90 minutes represented as \"01:90:00\" instead of \"01:30:00\"), spreadsheet or user data with minutes >= 60, or locale-formatted times that were partially normalized.","solutions":["Normalize by carrying overflow: 01:90:00 -> 02:30:00 before parsing.","Validate minutes between 0 and 59 before calling parseTime.","If the value is a duration, use a duration representation instead of `time`.","Catch IllegalArgumentException and re-prompt or report the invalid component."],"exampleFix":"// before\nlong nanos = ParseUtils.parseTime(\"01:90:00\"); // throws\n// after\nint minutes = 90, hours = 1;\nhours += minutes / 60; minutes %= 60;\nlong nanos = ParseUtils.parseTime(String.format(\"%02d:%02d:00\", hours, minutes));","handlingStrategy":"validation","validationCode":"int m = Integer.parseInt(s.substring(s.indexOf(':') + 1, s.indexOf(':', s.indexOf(':') + 1)));\nif (m < 0 || m > 59) throw new IllegalArgumentException(\"minute must be 0-59: \" + m);","typeGuard":null,"tryCatchPattern":"try { return ParseUtils.parseTime(s); }\ncatch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Invalid minutes in '\" + s + \"'\", e); }","preventionTips":["Carry minute overflow (>=60) into hours before parsing","Sanitize spreadsheet/user data that stores durations as times","Validate each hh/mm/ss component with regex ^\\d{2}$ ranges"],"tags":["parsing","time","range-check","illegal-argument"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}