apache/beam · error · IllegalArgumentException

Class %s missing a property named '%s'. Did you mean '%s'?

Error message

Class %s missing a property named '%s'. Did you mean '%s'?

What it means

Same missing-property error as its sibling, but Beam found exactly one existing property within Levenshtein distance 2 and suggests it: 'Did you mean <suggestion>?'. Thrown as IllegalArgumentException while converting string/JSON args to typed options.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java:1897

      propertyNamesToGetters.put(descriptor.getName(), descriptor.getReadMethod());
    }
    Map<String, Object> convertedOptions = Maps.newHashMap();
    for (final Map.Entry<String, Collection<String>> entry : options.asMap().entrySet()) {
      try {
        // Search for close matches for missing properties.
        // Either off by one or off by two character errors.
        if (!propertyNamesToGetters.containsKey(entry.getKey())) {
          SortedSet<String> closestMatches =
              new TreeSet<>(
                  Sets.filter(
                      propertyNamesToGetters.keySet(),
                      input -> StringUtils.getLevenshteinDistance(entry.getKey(), input) <= 2));
          switch (closestMatches.size()) {
            case 0:
              throw new IllegalArgumentException(
                  String.format("Class %s missing a property named '%s'.", klass, entry.getKey()));
            case 1:
              throw new IllegalArgumentException(
                  String.format(
                      "Class %s missing a property named '%s'. Did you mean '%s'?",
                      klass, entry.getKey(), Iterables.getOnlyElement(closestMatches)));
            default:
              throw new IllegalArgumentException(
                  String.format(
                      "Class %s missing a property named '%s'. Did you mean one of %s?",
                      klass, entry.getKey(), closestMatches));
          }
        }
        Method method = propertyNamesToGetters.get(entry.getKey());
        // Only allow empty argument values for String, String Array, and
        // Collection<String>.
        Class<?> returnType = method.getReturnType();
        JavaType type = MAPPER.getTypeFactory().constructType(method.getGenericReturnType());

        if ("runner".equals(entry.getKey())) {
          String runner = Iterables.getOnlyElement(entry.getValue());

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use the suggested property name from the error message
  2. Run with --help=<class> to confirm the exact property spelling

Example fix

// before
--numWorkerss=4
// after
--numWorkers=4
Defensive patterns

Strategy: validation

Validate before calling

List<String> candidates = allProps.stream().filter(p -> Math.abs(p.length() - key.length()) <= 2).collect(toList());
if (!allProps.contains(key) && candidates.size() == 1) key = candidates.get(0);

Try / catch

catch (IllegalArgumentException e) { if (e.getMessage().contains("Did you mean")) { /* adopt suggested name */ } }

Prevention

When it happens

Trigger: Setting an option key that doesn't exist but closely matches one existing property (edit distance <= 2), via fromArgs --flags or a JSON options map.

Common situations: Singular/plural mistakes (worker vs workers), swapped adjacent letters, or wrong capitalization of a single property name.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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