{"record":{"id":"615a980f72365c35","repo":"apache/beam","slug":"flushrowlimit-must-be-greater-than-0","errorCode":null,"errorMessage":"flushRowLimit must be greater than 0.","messagePattern":"flushRowLimit 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":160,"sourceCode":"    // Parse configured enum values to validate that they are supported.\n    String createDisposition = getCreateDisposition();\n    if (createDisposition != null) {\n      parseCreateDisposition(createDisposition);\n    }\n\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  }","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java#L142-L178","documentation":"validate() in SnowflakeWriteConfiguration rejects a flushRowLimit that is set but not strictly positive. flushRowLimit controls how many rows are buffered before a flush to Snowflake during streaming (SnowPipe) writes, so zero or negative values are meaningless and would prevent any batching. The check only fires when the value is explicitly configured (null is allowed).","triggerScenarios":"Setting flushRowLimit to 0 or a negative integer in SnowflakeWriteConfiguration (e.g. .withFlushRowLimit(0)) or via the corresponding SchemaTransform config before validate() runs.","commonSituations":"Developers pass a value read from YAML/JSON config where 0 was used as a placeholder for 'unset', or compute the limit dynamically and the computation yields 0 when an upstream list is empty.","solutions":["Set flushRowLimit to a positive integer (e.g. 10000) or leave it unset (null) to use the library default.","Fix the config source so 'unset' is represented as null/omitted rather than 0.","Guard dynamic computation: only call withFlushRowLimit when the computed value is > 0."],"exampleFix":"// before\n.withFlushRowLimit(0)\n// after\n.withFlushRowLimit(10000)","handlingStrategy":"validation","validationCode":"Integer flushRowLimit = cfg.getFlushRowLimit();\nif (flushRowLimit != null && flushRowLimit <= 0) {\n  throw new IllegalArgumentException(\"flushRowLimit must be > 0 or null\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  config.validate();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"flushRowLimit\")) { /* set a positive default, e.g. 10000 */ }\n  throw e;\n}","preventionTips":["Represent 'unset' as null/omitted, never as 0, in config files and flags.","Sanitize numeric config with a helper that maps <=0 to the library default.","Add unit tests covering all numeric snowflake config fields with boundary values."],"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"}