apache/beam · error · java.lang.IllegalArgumentException

Unsupported writeDisposition '" + value + "'. Supported…

Error message

Unsupported writeDisposition '" + value + "'. Supported values are APPEND, TRUNCATE, and EMPTY.

What it means

parseWriteDisposition maps a configuration string to the WriteDisposition enum via valueOf. Any value other than exactly APPEND, TRUNCATE, or EMPTY is rejected with an IllegalArgumentException showing the bad value and the supported set.

Solutions

  1. Pass exactly APPEND, TRUNCATE, or EMPTY.
  2. Normalize the string (trim + uppercase) before calling the parser.
  3. Prefer the enum constant directly instead of parsing strings where possible.

Example fix

// before
parseWriteDisposition("OVERWRITE")
// after
parseWriteDisposition("TRUNCATE")
Defensive patterns

Strategy: validation

Validate before calling

if (!value.equals("APPEND") && !value.equals("TRUNCATE") && !value.equals("EMPTY")) {
  throw new IllegalArgumentException("writeDisposition must be APPEND, TRUNCATE, or EMPTY");
}

Try / catch

try { disp = SnowflakeSchemaTransformUtils.parseWriteDisposition(raw); }
catch (IllegalArgumentException e) { disp = WriteDisposition.APPEND; }

Prevention

When it happens

Trigger: Passing e.g. "APPEND_ONLY", "OVERWRITE", "append", or "TRUNC" to parseWriteDisposition during Snowflake sink configuration.

Common situations: Lowercase or mixed-case values from YAML/env config; using synonyms from other warehouses (INSERT_OVERWRITE, REPLACE); copy-paste from BigQuery docs is fine here but Dataflow templates may inject unexpected defaults.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeSchemaTransformUtils.java:150

  }

  public static CreateDisposition parseCreateDisposition(String value) {
    try {
      return CreateDisposition.valueOf(value);
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          "Unsupported createDisposition '"
              + value
              + "'. Supported values are CREATE_IF_NEEDED and CREATE_NEVER.",
          e);
    }
  }

  public static WriteDisposition parseWriteDisposition(String value) {
    try {
      return WriteDisposition.valueOf(value);
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          "Unsupported writeDisposition '"
              + value
              + "'. Supported values are APPEND, TRUNCATE, and EMPTY.",
          e);
    }
  }

  public static SnowflakeTableSchema toSnowflakeTableSchema(Schema schema) {
    SnowflakeColumn[] columns =
        schema.getFields().stream()
            .map(SnowflakeSchemaTransformUtils::toSnowflakeColumn)
            .toArray(SnowflakeColumn[]::new);

    return SnowflakeTableSchema.of(columns);
  }

  public static SnowflakeColumn toSnowflakeColumn(Schema.Field field) {
    SnowflakeDataType snowflakeType = toSnowflakeDataType(field);

View on GitHub (pinned to 12126d8942)