junit-team/junit5 · error · IllegalArgumentException

Cannot override the standard style 'NONE'

Error message

Cannot override the standard style 'NONE'

What it means

ColorPalette(Map) constructor rejects any attempt to override Style.NONE (the ANSI reset style). Because NONE is the standard reset used by paint() to close every colored span, overriding it would corrupt all output formatting. An IllegalArgumentException is thrown at palette construction time.

Solutions

  1. Remove the 'NONE=' line from your palette properties file.
  2. When building overrides programmatically, filter out Style.NONE: overrides.remove(Style.NONE) or skip it in the builder loop.
  3. Leave NONE unset — it always maps to the ANSI reset sequence '0'.

Example fix

# before (palette.properties)
NONE=1
SUCCESSFUL=2
# after
SUCCESSFUL=2
Defensive patterns

Strategy: validation

Validate before calling

// Before building a palette, strip the reserved NONE key from overrides.
import java.util.*;
import org.junit.platform.console.output.*; // Style, ColorPalette
Map<Style,String> overrides = loadUserOverrides();
overrides.remove(Style.NONE); // never override the reset style

Prevention

When it happens

Trigger: Loading a color palette properties file (via --color-palette) that contains a 'NONE=...' entry, or programmatically constructing a ColorPalette with an overrides map that includes Style.NONE. The check happens before any overrides are applied.

Common situations: A hand-edited palette file that tries to set NONE; a copied palette template that included the reserved key; programmatic palette customization that naively iterates all Style values including NONE.

Related errors


AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11). Data as JSON: /api/errors/bc48cfbf33560b84. Report an issue: GitHub.

Appendix: source

Thrown at junit-platform-console/src/main/java/org/junit/platform/console/output/ColorPalette.java:76

	private static Map<Style, String> singleColorPalette() {
		Map<Style, String> colorsToAnsiSequences = new EnumMap<>(Style.class);
		colorsToAnsiSequences.put(Style.NONE, "0");
		colorsToAnsiSequences.put(Style.SUCCESSFUL, "1");
		colorsToAnsiSequences.put(Style.ABORTED, "4");
		colorsToAnsiSequences.put(Style.FAILED, "7");
		colorsToAnsiSequences.put(Style.SKIPPED, "9");
		colorsToAnsiSequences.put(Style.CONTAINER, "1");
		colorsToAnsiSequences.put(Style.TEST, "0");
		colorsToAnsiSequences.put(Style.DYNAMIC, "0");
		colorsToAnsiSequences.put(Style.REPORTED, "2");
		return colorsToAnsiSequences;
	}

	ColorPalette(Map<Style, String> overrides) {
		this(defaultPalette(), false);

		if (overrides.containsKey(Style.NONE)) {
			throw new IllegalArgumentException("Cannot override the standard style 'NONE'");
		}
		this.colorsToAnsiSequences.putAll(overrides);
	}

	ColorPalette(Properties properties) {
		this(toOverrideMap(properties));
	}

	ColorPalette(Reader reader) {
		this(getProperties(reader));
	}

	public ColorPalette(Path path) {
		this(getProperties(path));
	}

	private ColorPalette(Map<Style, String> colorsToAnsiSequences, boolean disableAnsiColors) {
		this.colorsToAnsiSequences = colorsToAnsiSequences;

View on GitHub (pinned to f070c699a0)