JetBrains/intellij-community · error · IllegalArgumentException

Cannot find group {groupName}

Error message

Cannot find group {groupName}

What it means

Thrown by LwRootContainer.getButtonGroupComponentIds when no registered LwButtonGroup has the requested name. Button groups are declared in the form's button-groups section; queries for a group that was never declared (or was renamed) are programming/data errors and fail fast with IllegalArgumentException instead of returning null.

Source

Thrown at java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwRootContainer.java:113

    for (LwButtonGroup group : myButtonGroups) {
      final String[] ids = group.getComponentIds();
      for (String id : ids) {
        if (id.equals(component.getId())) {
          return group.getName();
        }
      }
    }
    return null;
  }

  @Override
  public String[] getButtonGroupComponentIds(String groupName) {
    for (LwButtonGroup group : myButtonGroups) {
      if (group.getName().equals(groupName)) {
        return group.getComponentIds();
      }
    }
    throw new IllegalArgumentException("Cannot find group " + groupName);
  }

  @Override
  public boolean isInspectionSuppressed(final String inspectionId, final String componentId) {
    for (LwInspectionSuppression suppression : myInspectionSuppressions) {
      if ((suppression.getComponentId() == null || suppression.getComponentId().equals(componentId)) &&
          suppression.getInspectionId().equals(inspectionId)) {
        return true;
      }
    }
    return false;
  }

  public LwInspectionSuppression[] getInspectionSuppressions() {
    return myInspectionSuppressions.toArray(LwInspectionSuppression.EMPTY_ARRAY);
  }
}

View on GitHub (pinned to be881553f2)

Solutions

  1. Open the .form XML and add a <group name="..."/> entry under <button-groups> matching the name referenced by the component.
  2. Or remove/fix the buttongroup attribute on components referencing the missing group.
  3. Re-open the form in the GUI designer so it reconciles button-group declarations with component references.

Example fix

<!-- before -->
<radiobutton id="rb1" buttongroup="mode"/>
<button-groups/> 

<!-- after -->
<radiobutton id="rb1" buttongroup="mode"/>
<button-groups>
  <group name="mode">
    <button id="rb1"/>
  </group>
</button-groups>
Defensive patterns

Strategy: validation

Validate before calling

// Check the group exists before querying component ids
boolean exists = rootContainer.getButtonGroups().stream().anyMatch(g -> g.getName().equals(groupName));
if (!exists) throw new IllegalArgumentException("Undeclared button group: " + groupName);

Try / catch

try { ids = root.getButtonGroupComponentIds(groupName); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Cannot find group")) { /* declare the group in button-groups or fix the reference */ } else throw e; }

Prevention

When it happens

Trigger: Calling getButtonGroupComponentIds(groupName) where groupName does not equal any group name in myButtonGroups — e.g. a component references buttongroup="myGroup" but the <button-groups> section lacks a <group name="myGroup"> entry, or the group was renamed in the designer without updating references.

Common situations: Form XML edited by hand: a radio button's buttongroup attribute points to a group that is not declared; groups removed in the designer while components still reference them; tooling that reads form files querying group names by convention.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/c410c789fc078793. Report an issue: GitHub.