apache/beam · error · IllegalArgumentException

No option found with name

Error message

No option found with name %s.

What it means

Schema.Options.getValue(optionName) throws IllegalArgumentException when no option with that name exists in the options map. It is a strict lookup: unlike getValue(name, class), there is no null-returning variant.

Solutions

  1. Check hasOption(optionName) before calling getValue.
  2. Use the two-argument getValue(name, valueClass) only after confirming existence, or guard with hasOption to get null-safe behavior.
  3. Fix the option name string to match exactly what setOption stored.

Example fix

// before
String v = schema.getOptions().getValue("owner");

// after
String v = schema.getOptions().hasOption("owner")
    ? schema.getOptions().getValue("owner", String.class)
    : null;
Defensive patterns

Strategy: validation

Validate before calling

// Java: check option existence first
boolean present = schema.getOptions().hasOption("owner");

Type guard

// Java
public static <T> T optionOrNull(Schema s, String name, Class<T> clazz) {
  return s.getOptions().hasOption(name) ? s.getOptions().getValue(name, clazz) : null;
}

Prevention

When it happens

Trigger: Calling schema.getOptions().getValue("name") where setOption was never called with that exact option name (typo, case mismatch, or option set on a different Schema instance).

Common situations: Renaming options between pipeline versions; hardcoding option strings that drift from what producers set; reading options from a schema constructed by another library path.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java:1391

      return new Builder(new HashMap<>(this.options));
    }

    public static Options.Builder builder() {
      return new Builder();
    }

    public static Options none() {
      return new Options();
    }

    /** Get the value of an option. If the option is not found null is returned. */
    @SuppressWarnings("TypeParameterUnusedInFormals")
    public <T> T getValue(String optionName) {
      Option option = options.get(optionName);
      if (option != null) {
        return option.getValue();
      }
      throw new IllegalArgumentException(
          String.format("No option found with name %s.", optionName));
    }

    /** Get the value of an option. If the option is not found null is returned. */
    public <T> T getValue(String optionName, Class<T> valueClass) {
      return getValue(optionName);
    }

    /** Get the value of an option. If the option is not found the default value is returned. */
    public <T> T getValueOrDefault(String optionName, T defaultValue) {
      Option option = options.get(optionName);
      if (option != null) {
        return option.getValue();
      }
      return defaultValue;
    }

    /** Get the type of an option. */

View on GitHub (pinned to 12126d8942)