apache/maven · error · IllegalStateException

Cannot reset sourceLevel attribute; it is already set to: {}

Error message

Cannot reset sourceLevel attribute; it is already set to: {}

What it means

Error "Cannot reset sourceLevel attribute; it is already set to: {}" thrown in apache/maven.

Source

Thrown at api/maven-api-settings/src/main/mdo/settings.mdo:62

      <name>TrackableBase</name>
      <version>1.0.0+</version>
      <description>
        Common base class that contains code to track the source for this instance.
      </description>
      <codeSegments>
        <codeSegment>
          <version>1.0.0/1.3.0</version>
          <code>
    public static final String USER_LEVEL = "user-level";
    public static final String PROJECT_LEVEL = "project-level";
    public static final String GLOBAL_LEVEL = "global-level";

    private String sourceLevel = USER_LEVEL;
    private boolean sourceLevelSet = false;

    public void setSourceLevel(String sourceLevel) {
        if (sourceLevelSet) {
            throw new IllegalStateException("Cannot reset sourceLevel attribute; it is already set to: " + sourceLevel);
        } else if (!(USER_LEVEL.equals(sourceLevel) || PROJECT_LEVEL.equals(sourceLevel)  || GLOBAL_LEVEL.equals(sourceLevel))) {
            throw new IllegalArgumentException("sourceLevel must be one of: {" + USER_LEVEL + "," + PROJECT_LEVEL + "," + GLOBAL_LEVEL + "}");
        } else {
            this.sourceLevel = sourceLevel;
            this.sourceLevelSet = true;
        }
    }

    public String getSourceLevel() {
        return sourceLevel;
    }
          </code>
        </codeSegment>
      </codeSegments>
    </class>
    <class>
      <name>IdentifiableBase</name>
      <superClass>TrackableBase</superClass>

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at api/maven-api-settings/src/main/mdo/settings.mdo:62 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/0489b672cc863432. Report an issue: GitHub.