apache/hadoop · error · IllegalArgumentException

bad framework group name: ${name}

Error message

bad framework group name: ${name}

What it means

The string counterpart of the id lookup: CounterGroupFactory resolves group names to framework group objects through a name-to-group map (s2i, plus the FS group name). throwBadFrameworkGroupNameException throws IllegalArgumentException when a name is not a registered framework group name, i.e. the factory was asked to create a framework group for a name that is actually generic (or unknown).

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/CounterGroupFactory.java:166

  }

  /**
   * Check whether a group name is a name of a framework group (including
   * the filesystem group).
   *
   * @param name  to check
   * @return true for framework group names
   */
  public static synchronized boolean isFrameworkGroup(String name) {
    return s2i.get(name) != null || name.equals(FS_GROUP_NAME);
  }

  private static void throwBadFrameGroupIdException(int id) {
    throw new IllegalArgumentException("bad framework group id: "+ id);
  }

  private static void throwBadFrameworkGroupNameException(String name) {
    throw new IllegalArgumentException("bad framework group name: "+ name);
  }

  /**
   * Abstract factory method to create a generic (vs framework) counter group
   * @param name  of the group
   * @param displayName of the group
   * @param limits limits of the counters
   * @return a new generic counter group
   */
  protected abstract G newGenericGroup(String name, String displayName,
                                       Limits limits);

  /**
   * Abstract factory method to create a file system counter group
   * @return a new file system counter group
   */
  protected abstract G newFileSystemGroup();
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Use the public API: counters.getGroup(name)/findCounter(group, name) route framework names to framework groups and everything else to generic groups automatically.
  2. If you must touch the factory, gate the call with CounterGroupFactory.isFrameworkGroup(name) first.
  3. In forks, register renamed/added groups in the factory map before use.

Example fix

// before (internal API misuse)
G group = factory.newFrameworkGroup("MyCustomGroup"); // IllegalArgumentException

// after (public API routes generic names correctly)
Counters counters = new Counters();
Counter c = counters.findCounter("MyCustomGroup", "MY_COUNTER");
Defensive patterns

Strategy: validation

Validate before calling

String name = ...;
if (!CounterGroupFactory.isFrameworkGroup(name)) {
  // generic group path - use public counters API instead of the factory
  counters.findCounter(name, "MY_COUNTER");
}

Prevention

When it happens

Trigger: Internal code paths that call newFrameworkGroup(String name) (or equivalent lookups) with a name that is neither in the framework registry nor FS_GROUP_NAME - e.g. passing "MyCustomGroup" where only names like "org.apache.hadoop.mapreduce.TaskCounter" or the filesystem group name are valid.

Common situations: Custom code or reflection reaching into the private CounterGroupFactory API; forks that renamed framework groups; copying internal code that assumes any counter group name is a framework group.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/659232a73656a15e. Report an issue: GitHub.