junit-team/junit5 · error · IllegalArgumentException
Cannot override the standard style 'NONE'
Error message
Cannot override the standard style 'NONE'
What it means
Thrown by the ColorPalette override constructor when the supplied override map contains an entry for Style.NONE. NONE is the reserved ANSI reset style (code 0) that ColorPalette always sets itself in defaultPalette(); it cannot be redefined by the user because doing so would corrupt the reset terminator appended by paint(). The guard is an explicit IllegalArgumentException at ColorPalette.java:76.
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 956246301e)
Solutions
- Open the offending palette properties file and delete the 'NONE=...' line entirely; NONE is non-overridable by design.
- If you intended a base/foreground color, use an overridable style: SUCCESSFUL, ABORTED, FAILED, SKIPPED, CONTAINER, TEST, DYNAMIC, REPORTED.
- Validate the override map before constructing: remove or reject any key equal to Style.NONE.
- If you must disable all ANSI coloring, use the predefined ColorPalette.NONE palette instead of overriding NONE.
Example fix
// before
Properties props = new Properties();
props.setProperty("NONE", "31"); // or in file: NONE=31
ColorPalette palette = new ColorPalette(props); // throws
// after
Properties props = new Properties();
props.setProperty("FAILED", "31");
props.setProperty("SUCCESSFUL", "32");
ColorPalette palette = new ColorPalette(props); // ok Defensive patterns
Strategy: validation
Validate before calling
Map<Style,String> safeOverrides = new HashMap<>(overrides);
safeOverrides.remove(Style.NONE); // strip reserved key before constructing
if (overrides.containsKey(Style.NONE)) {
throw new IllegalArgumentException("NONE is reserved; remove it from the override map");
}
ColorPalette palette = new ColorPalette(safeOverrides); Type guard
static boolean hasNoReservedStyleKeys(Map<Style,String> overrides) {
return !overrides.containsKey(Style.NONE);
} Try / catch
try {
return new ColorPalette(overrides);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("NONE")) {
overrides.remove(Style.NONE);
return new ColorPalette(overrides);
}
throw e;
} Prevention
- When editing a palette properties file, only include overridable Style names: SUCCESSFUL, ABORTED, FAILED, SKIPPED, CONTAINER, TEST, DYNAMIC, REPORTED.
- Never emit NONE from tooling that generates palette files.
- Unit-test palette construction against your properties file in CI.
When it happens
Trigger: Constructing ColorPalette from a properties file, Reader, or Path (which all funnel into ColorPalette(Map<Style,String> overrides) at line 72) where the map produced by toOverrideMap() contains the key 'NONE'. Concretely: a junit-platform console color palette properties file containing the line 'NONE=31' or a hand-built Map passed via the package-private constructor.
Common situations: Authoring a custom ANSI color palette .properties file for the console launcher and mistakenly treating NONE as a style to recolor; copying a palette template that lists all Style enum values including NONE; the key matching is case-insensitive (toUpperCase(Locale.ROOT) in toOverrideMap at line 99-100) so a user writing 'none' thinking it inert still triggers it.
Related errors
- Could not read color palette properties
- Could not open color palette properties file
- Failed to transform configuration parameter with key '%s' an
- Failed to create ForkJoinPool
- Invalid DiscoveryIssue.Severity '%s' set via the '%s' config
AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04).
Data as JSON: /data/errors/bc48cfbf33560b84.json.
Report an issue: GitHub.