{"record":{"id":"d5102511b6cda623","repo":"apache/beam","slug":"flushtimelimitmillis-must-be-greater-than-0","errorCode":null,"errorMessage":"flushTimeLimitMillis must be greater than 0.","messagePattern":"flushTimeLimitMillis must be greater than 0\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java","lineNumber":165,"sourceCode":"\n    String writeDisposition = getWriteDisposition();\n    if (writeDisposition != null) {\n      parseWriteDisposition(writeDisposition);\n    }\n\n    String debugMode = getDebugMode();\n    if (debugMode != null) {\n      parseStreamingLogLevel(debugMode);\n    }\n\n    Integer flushRowLimit = getFlushRowLimit();\n    if (flushRowLimit != null && flushRowLimit <= 0) {\n      throw new IllegalArgumentException(\"flushRowLimit must be greater than 0.\");\n    }\n\n    Long flushTimeLimitMillis = getFlushTimeLimitMillis();\n    if (flushTimeLimitMillis != null && flushTimeLimitMillis <= 0) {\n      throw new IllegalArgumentException(\"flushTimeLimitMillis must be greater than 0.\");\n    }\n\n    Integer shardsNumber = getShardsNumber();\n    if (shardsNumber != null && shardsNumber <= 0) {\n      throw new IllegalArgumentException(\"shardsNumber must be greater than 0.\");\n    }\n  }\n\n  private static void requireNonEmpty(String value, String name) {\n    if (value == null || value.isEmpty()) {\n      throw new IllegalArgumentException(name + \" cannot be empty\");\n    }\n  }\n\n  @AutoValue.Builder\n  public abstract static class Builder {\n\n    public abstract Builder setServerName(String value);","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java#L147-L183","documentation":"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.","triggerScenarios":"Setting flushTimeLimitMillis to 0 or a negative long (e.g. .withFlushTimeLimitMillis(0L)) in the Snowflake streaming write configuration.","commonSituations":"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.","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."],"exampleFix":"// before\n.withFlushTimeLimitMillis(0L)\n// after\n.withFlushTimeLimitMillis(Duration.standardMinutes(5).getMillis())","handlingStrategy":"validation","validationCode":"Long flushTimeLimitMillis = cfg.getFlushTimeLimitMillis();\nif (flushTimeLimitMillis != null && flushTimeLimitMillis <= 0) {\n  throw new IllegalArgumentException(\"flushTimeLimitMillis must be > 0 or null\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  config.validate();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"flushTimeLimitMillis\")) { /* set e.g. 300000L */ }\n  throw e;\n}","preventionTips":["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."],"tags":["java","configuration","snowflake","streaming"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}