{"record":{"id":"b3f4ec3cec66ed20","repo":"alibaba/Sentinel","slug":"invalid-second-interval-cannot-divide-by-60","errorCode":null,"errorMessage":"Invalid second interval (cannot divide by 60): ","messagePattern":"Invalid second interval \\(cannot divide by 60\\): ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/StatLoggerBuilder.java","lineNumber":100,"sourceCode":"            EagleEyeRollingFileAppender rfAppender = new EagleEyeRollingFileAppender(filePath, maxFileSize);\n            appender = new SyncAppender(rfAppender);\n        }\n\n        EagleEyeLogDaemon.watch(appender);\n        return new StatLogger(loggerName, appender, intervalMillis, maxEntryCount,\n            entryDelimiter, keyDelimiter, valueDelimiter);\n    }\n\n    public StatLogger buildSingleton() {\n        return StatLogController.createLoggerIfNotExists(this);\n    }\n\n    static void validateInterval(final long intervalSeconds) throws IllegalArgumentException {\n        if (intervalSeconds < 1) {\n            throw new IllegalArgumentException(\"Interval cannot be less than 1\" + intervalSeconds);\n        } else if (intervalSeconds < 60) {\n            if (60 % intervalSeconds != 0) {\n                throw new IllegalArgumentException(\"Invalid second interval (cannot divide by 60): \" + intervalSeconds);\n            }\n        } else if (intervalSeconds <= 5 * 60) {\n            if (intervalSeconds % 60 != 0) {\n                throw new IllegalArgumentException(\"Invalid second interval (cannot divide by 60): \" + intervalSeconds);\n            }\n            if (60 % intervalSeconds != 0) {\n                throw new IllegalArgumentException(\"Invalid second interval (cannot divide by 60): \" + intervalSeconds);\n            }\n        } else if (intervalSeconds > 5 * 60) {\n            throw new IllegalArgumentException(\"Interval should be less than 5 min: \" + intervalSeconds);\n        }\n    }\n}\n","sourceCodeStart":82,"sourceCodeEnd":114,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/StatLoggerBuilder.java#L82-L114","documentation":"This is the first divisibility rule in validateInterval: for intervals of 1-59 seconds, EagleEye requires that intervalSeconds evenly divides 60 (60 % intervalSeconds == 0) so flush boundaries align with minute boundaries in the time-based file naming/rolling scheme. Values like 7, 8, or 45 throw IllegalArgumentException.","triggerScenarios":"Calling intervalSeconds(n) with 1 <= n < 60 and 60 % n != 0 — e.g. 7s, 8s, 9s, 11s, 45s. Commonly a computed interval (60/7 rounded) or a copied example value that is not a divisor of 60.","commonSituations":"Teams pick a 'nice' number like 15 or 30 (valid) vs 20 (valid) but also 7 or 45 (invalid) without knowing the constraint. Interval derived from another setting (e.g. one tenth of a 7-second upstream cycle). Config values copied between projects with different validation rules.","solutions":["Use a divisor of 60: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, or 30 seconds.","Round computed intervals to the nearest valid divisor before calling the builder.","Validate candidate intervals at startup with a helper mirroring the divisibility rule."],"exampleFix":"// before\nbuilder.intervalSeconds(7); // 60 % 7 != 0 -> throws\n\n// after\nbuilder.intervalSeconds(5); // 60 % 5 == 0","handlingStrategy":"validation","validationCode":"boolean isValidSubMinute(int s) { return s >= 1 && s < 60 && 60 % s == 0; }\nif (!isValidSubMinute(intervalSeconds)) { /* pick 1,2,3,5,10,15,30 */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict interval configs to the whitelist 1,2,3,5,10,15,30,60.","Snap computed intervals to the nearest divisor of 60.","Document the divisibility rule next to the config key."],"tags":["eagleeye","stat-logger","config","interval","validation","illegal-argument","sentinel"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}