apache/beam · error · IllegalArgumentException

cannot be empty

Error message

${name} cannot be empty

What it means

SnowflakeWriteConfiguration.requireNonEmpty() throws '<name> cannot be empty' when a mandatory string configuration field (such as storageIntegrationName, serverName, database, schema, or stagingBucketName) is null or an empty string. validate() calls this helper for each required field, failing fast at pipeline construction with an IllegalArgumentException whose message names the offending property.

Solutions

  1. Read the message to identify which '<name>' is empty and set it on the builder/transform, e.g. .withStorageIntegrationName("MY_INTEGRATION").
  2. Validate upstream inputs (env vars, flags, config files) before building the configuration.
  3. Check for typos between config keys and builder methods so values actually reach the builder.

Example fix

// before
SnowflakeIO.write().withStagingBucketName("")
// after
SnowflakeIO.write().withStagingBucketName("gs://my-bucket/")
Defensive patterns

Strategy: validation

Validate before calling

for (Map.Entry<String,String> e : requiredStrings.entrySet()) {
  if (e.getValue() == null || e.getValue().isEmpty()) {
    throw new IllegalArgumentException(e.getKey() + " cannot be empty");
  }
}

Try / catch

try {
  config.validate();
} catch (IllegalArgumentException e) {
  if (e.getMessage().endsWith("cannot be empty")) { /* set the named field and retry */ }
  throw e;
}

Prevention

When it happens

Trigger: Building a SnowflakeWriteConfiguration (or using the Snowflake write SchemaTransform) without setting any required string field, e.g. omitting storageIntegrationName/serverName/database/schema, or setting one to "".

Common situations: Config values read from environment variables or flags that are unset (empty string), YAML keys commented out, or typo'd builder method so the expected field never gets populated.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/949c15b59a503369. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java:176

    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);

    public abstract Builder setUsername(@Nullable String value);

    public abstract Builder setPassword(@Nullable String value);

    public abstract Builder setOauthToken(@Nullable String value);

    public abstract Builder setPrivateKey(@Nullable String value);

    public abstract Builder setPrivateKeyPassphrase(@Nullable String value);

View on GitHub (pinned to 12126d8942)