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-toolchain/src/main/mdo/toolchains.mdo:69

      <name>TrackableBase</name>
      <version>1.1.0+</version>
      <description>
        Common base class that contains code to track the source for this instance.
      </description>
      <codeSegments>
        <codeSegment>
          <version>1.1.0/1.1.0</version>
          <code>
            <![CDATA[
        public static final String USER_LEVEL = "user-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) || GLOBAL_LEVEL.equals(sourceLevel))) {
                throw new IllegalArgumentException("sourceLevel must be one of: {" + USER_LEVEL + "," + GLOBAL_LEVEL + "}");
            } else {
                this.sourceLevel = sourceLevel;
                this.sourceLevelSet = true;
            }
        }

        public String getSourceLevel() {
            return sourceLevel;
        }
                ]]>
          </code>
        </codeSegment>
      </codeSegments>
    </class>
    <class rootElement="true" xml.tagName="toolchains" xsd.compositor="sequence">
      <name>PersistedToolchains</name>

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at api/maven-api-toolchain/src/main/mdo/toolchains.mdo:69 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/24281e83adbd91bb. Report an issue: GitHub.