apache/beam · error · java.lang.IllegalArgumentException
flushTimeLimitMillis must be greater than 0.
Error message
flushTimeLimitMillis must be greater than 0.
What it means
validate() in SnowflakeWriteConfiguration rejects a flushTimeLimitMillis that is set but not strictly positive. This limit controls how often buffered streaming rows are flushed to Snowflake by time, so a zero or negative duration is invalid. The check fires only when the value is explicitly provided.
Solutions
- Set flushTimeLimitMillis to a positive value in milliseconds (e.g. 300000L for 5 minutes) or omit it to use the default.
- Check unit conversions feeding this value; keep the value in milliseconds end-to-end.
- Treat 'no limit' as null/omitted rather than 0.
Example fix
// before .withFlushTimeLimitMillis(0L) // after .withFlushTimeLimitMillis(Duration.standardMinutes(5).getMillis())
Defensive patterns
Strategy: validation
Validate before calling
Long flushTimeLimitMillis = cfg.getFlushTimeLimitMillis();
if (flushTimeLimitMillis != null && flushTimeLimitMillis <= 0) {
throw new IllegalArgumentException("flushTimeLimitMillis must be > 0 or null");
} Try / catch
try {
config.validate();
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("flushTimeLimitMillis")) { /* set e.g. 300000L */ }
throw e;
} Prevention
- Keep durations in milliseconds end-to-end; convert once at the config boundary.
- Avoid integer division when converting smaller time units to millis.
- Express durations with a duration type/library rather than raw longs where possible.
When it happens
Trigger: Setting flushTimeLimitMillis to 0 or a negative long (e.g. .withFlushTimeLimitMillis(0L)) in the Snowflake streaming write configuration.
Common situations: A duration passed through from another system in different units converts to 0 after integer division (e.g. 500 microseconds / 1000), or 0 is used as a sentinel for 'no limit' in user config.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- flushRowLimit must be greater than 0.
- shardsNumber must be greater than 0.
- snowPipe is required for streaming writes.
- Either table or query must be specified.
- Failed to setLoginTimeout
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d5102511b6cda623.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java:165
String writeDisposition = getWriteDisposition();
if (writeDisposition != null) {
parseWriteDisposition(writeDisposition);
}
String debugMode = getDebugMode();
if (debugMode != null) {
parseStreamingLogLevel(debugMode);
}
Integer flushRowLimit = getFlushRowLimit();
if (flushRowLimit != null && flushRowLimit <= 0) {
throw new IllegalArgumentException("flushRowLimit must be greater than 0.");
}
Long flushTimeLimitMillis = getFlushTimeLimitMillis();
if (flushTimeLimitMillis != null && flushTimeLimitMillis <= 0) {
throw new IllegalArgumentException("flushTimeLimitMillis must be greater than 0.");
}
Integer shardsNumber = getShardsNumber();
if (shardsNumber != null && shardsNumber <= 0) {
throw new IllegalArgumentException("shardsNumber must be greater than 0.");
}
}
private static void requireNonEmpty(String value, String name) {
if (value == null || value.isEmpty()) {
throw new IllegalArgumentException(name + " cannot be empty");
}
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder setServerName(String value);View on GitHub (pinned to 12126d8942)