apache/beam · error · java.lang.IllegalArgumentException

name + " cannot be empty"

Error message

name + " cannot be empty"

What it means

requireNonEmpty is a helper in SnowflakeReadSchemaTransformProvider that throws IllegalArgumentException('<name> cannot be empty') when a required string parameter (e.g. serverName, database, stagingBucketName, storageIntegration) is null or empty. validate() calls it for each mandatory field.

Solutions

  1. Set the field named in the message (e.g. setServerName("myaccount.us-east-1.snowflakecomputing.com")).
  2. Audit the configuration against the provider's documented required parameters.
  3. Add your own preflight validation of the config object before expand() to fail fast with clear context.
  4. Check templated/interpolated values actually resolve to non-empty strings.

Example fix

// before
SnowflakeReadSchemaTransformConfiguration.builder().setDatabase("DB").setTable("T").build();
// after
SnowflakeReadSchemaTransformConfiguration.builder()
    .setServerName("acct.snowflakecomputing.com").setDatabase("DB").setSchema("PUBLIC").setTable("T").build();
Defensive patterns

Strategy: validation

Validate before calling

java.util.List<String> missing = new java.util.ArrayList<>();
if (serverName == null || serverName.isEmpty()) missing.add("serverName");
if (database == null || database.isEmpty()) missing.add("database");
if (!missing.isEmpty()) throw new IllegalArgumentException("Missing Snowflake fields: " + missing);

Prevention

When it happens

Trigger: Building a SnowflakeReadSchemaTransformConfiguration without setting a required field that validate() checks via requireNonEmpty — the exception's message names the field, e.g. 'serverName cannot be empty'.

Common situations: Partial YAML configs where optional-looking keys were omitted; environment-specific values not injected (null from placeholder substitution); copying an example and deleting fields believed unneeded.

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/870730d6d52d5c6b. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeReadSchemaTransformProvider.java:247

      if (!tablePresent && !queryPresent) {
        throw new IllegalArgumentException("Either table or query must be specified.");
      }

      if (tablePresent && queryPresent) {
        throw new IllegalArgumentException("table and query are mutually exclusive.");
      }

      if (!getStagingBucketName().endsWith("/")) {
        throw new IllegalArgumentException("stagingBucketName must end with '/'");
      }

      // Validate JSON schema early.
      JsonUtils.beamSchemaFromJsonSchema(getSchema());
    }

    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)