{"record":{"id":"2ea3fd896cd85349","repo":"apache/beam","slug":"provided-size-s-is-bigger-than-max-size-s","errorCode":null,"errorMessage":"Provided size %s is bigger than max size %s ","messagePattern":"Provided size (.+?) is bigger than max size (.+?) ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/text/SnowflakeBinary.java","lineNumber":44,"sourceCode":"public class SnowflakeBinary implements SnowflakeDataType, Serializable {\n\n  public static final Long MAX_SIZE = 8388608L;\n\n  private Long size; // bytes\n\n  public SnowflakeBinary() {}\n\n  public static SnowflakeBinary of() {\n    return new SnowflakeBinary();\n  }\n\n  public static SnowflakeBinary of(long size) {\n    return new SnowflakeBinary(size);\n  }\n\n  public SnowflakeBinary(long size) {\n    if (size > MAX_SIZE) {\n      throw new IllegalArgumentException(\n          String.format(\"Provided size %s is bigger than max size %s \", size, MAX_SIZE));\n    }\n    this.size = size;\n  }\n\n  @Override\n  public String sql() {\n    if (size != null) {\n      return String.format(\"BINARY(%d)\", size);\n    }\n    return \"BINARY\";\n  }\n\n  public Long getSize() {\n    return size;\n  }\n\n  public void setSize(Long size) {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/text/SnowflakeBinary.java#L26-L62","documentation":"SnowflakeBinary.of()/the SnowflakeBinary(long) constructor validates the declared BINARY column size against MAX_SIZE (Snowflake's maximum binary size, 8388608 bytes). Sizes above the maximum cannot be represented by Snowflake's BINARY type, so the constructor throws an IllegalArgumentException.","triggerScenarios":"Creating SnowflakeBinary.of(size) or new SnowflakeBinary(size) with size > 8388608 (Snowflake BINARY max), e.g. SnowflakeBinary.of(16777216).","commonSituations":"Confusing the Snowflake BINARY limit with other engines' larger limits (e.g. 16 MB/64 MB blobs), or multiplying byte sizes incorrectly when defining table schema columns.","solutions":["Reduce the declared size to at most 8388608 (8 MB), typically SnowflakeBinary.of(8388608) for max-size columns.","If the data exceeds 8 MB, store it externally (cloud storage) and keep a reference/URL in the table instead.","Check where the size constant comes from and correct the unit/conversion producing the oversized value."],"exampleFix":"// before\nSnowflakeBinary.of(16777216)\n// after\nSnowflakeBinary.of(8388608)","handlingStrategy":"validation","validationCode":"if (size > SnowflakeBinary.MAX_SIZE) {\n  throw new IllegalArgumentException(\"size must be <= \" + SnowflakeBinary.MAX_SIZE);\n}","typeGuard":"static boolean isValidBinarySize(long size) { return size >= 0 && size <= 8388608L; }","tryCatchPattern":"try {\n  SnowflakeBinary col = SnowflakeBinary.of(size);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"bigger than max size\")) { size = SnowflakeBinary.MAX_SIZE; }\n  else throw e;\n}","preventionTips":["Clamp declared BINARY sizes to SnowflakeBinary.MAX_SIZE (8388608) when porting schemas.","Store oversized blobs in cloud storage and reference them by URL instead.","Add schema-definition unit tests that construct every column type used by the pipeline."],"tags":["java","snowflake","schema","validation"],"backgroundTag":"value-out-of-range","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"}