apache/beam · error · java.lang.IllegalArgumentException

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

Error message

Unsupported createDisposition '" + value + "'. Supported values are CREATE_IF_NEEDED and CREATE_NEVER.

What it means

parseCreateDisposition maps a configuration string to BigQuery-style CreateDisposition enum via valueOf. Unsupported strings are rethrown as IllegalArgumentException listing the only valid values: CREATE_IF_NEEDED and CREATE_NEVER.

Solutions

  1. Use exactly CREATE_IF_NEEDED or CREATE_NEVER.
  2. Normalize input with value.trim().toUpperCase(Locale.ROOT) before parsing.
  3. Catch IllegalArgumentException around the parse call when handling external config.

Example fix

// before
parseCreateDisposition("CREATE_IF_NOT_EXISTS")
// after
parseCreateDisposition("CREATE_IF_NEEDED")
Defensive patterns

Strategy: validation

Validate before calling

if (!value.equals("CREATE_IF_NEEDED") && !value.equals("CREATE_NEVER")) {
  throw new IllegalArgumentException("createDisposition must be CREATE_IF_NEEDED or CREATE_NEVER");
}

Try / catch

try { disp = SnowflakeSchemaTransformUtils.parseCreateDisposition(raw); }
catch (IllegalArgumentException e) { disp = CreateDisposition.CREATE_IF_NEEDED; }

Prevention

When it happens

Trigger: Passing any string other than exactly "CREATE_IF_NEEDED" or "CREATE_NEVER" to parseCreateDisposition when configuring the Snowflake sink.

Common situations: Typo like CREATE_IF_NEEDEd or create_if_needed (case matters); reusing disposition names from other systems (e.g. CREATE_IF_NOT_EXISTS); stale config from an older pipeline template.

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/052bb907ea0fbdd7. Report an issue: GitHub.

Appendix: source

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

  @EnsuresNonNullIf(expression = "#1", result = true)
  public static boolean isNotEmpty(@Nullable String value) {
    return value != null && !value.isEmpty();
  }

  public static StreamingLogLevel parseStreamingLogLevel(String value) {
    try {
      return StreamingLogLevel.valueOf(value);
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          "Unsupported debugMode '" + value + "'. Supported values are ERROR and INFO.", e);
    }
  }

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

View on GitHub (pinned to 12126d8942)