alibaba/Sentinel · error · IllegalArgumentException
Invalid second interval (cannot divide by 60):
Error message
Invalid second interval (cannot divide by 60):
What it means
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.
Source
Thrown at sentinel-core/src/main/java/com/alibaba/csp/sentinel/eagleeye/StatLoggerBuilder.java:100
EagleEyeRollingFileAppender rfAppender = new EagleEyeRollingFileAppender(filePath, maxFileSize);
appender = new SyncAppender(rfAppender);
}
EagleEyeLogDaemon.watch(appender);
return new StatLogger(loggerName, appender, intervalMillis, maxEntryCount,
entryDelimiter, keyDelimiter, valueDelimiter);
}
public StatLogger buildSingleton() {
return StatLogController.createLoggerIfNotExists(this);
}
static void validateInterval(final long intervalSeconds) throws IllegalArgumentException {
if (intervalSeconds < 1) {
throw new IllegalArgumentException("Interval cannot be less than 1" + intervalSeconds);
} else if (intervalSeconds < 60) {
if (60 % intervalSeconds != 0) {
throw new IllegalArgumentException("Invalid second interval (cannot divide by 60): " + intervalSeconds);
}
} else if (intervalSeconds <= 5 * 60) {
if (intervalSeconds % 60 != 0) {
throw new IllegalArgumentException("Invalid second interval (cannot divide by 60): " + intervalSeconds);
}
if (60 % intervalSeconds != 0) {
throw new IllegalArgumentException("Invalid second interval (cannot divide by 60): " + intervalSeconds);
}
} else if (intervalSeconds > 5 * 60) {
throw new IllegalArgumentException("Interval should be less than 5 min: " + intervalSeconds);
}
}
}
View on GitHub (pinned to a3f40ba8e9)
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.
Example fix
// before builder.intervalSeconds(7); // 60 % 7 != 0 -> throws // after builder.intervalSeconds(5); // 60 % 5 == 0
Defensive patterns
Strategy: validation
Validate before calling
boolean isValidSubMinute(int s) { return s >= 1 && s < 60 && 60 % s == 0; }
if (!isValidSubMinute(intervalSeconds)) { /* pick 1,2,3,5,10,15,30 */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Interval should be less than 5 min:
- Max entry count should be at least 1:
- Interval cannot be less than 1
- keys empty or null: ${keys}
- keys empty or null
AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14).
Data as JSON: /api/errors/b3f4ec3cec66ed20.
Report an issue: GitHub.