{"record":{"id":"bc48cfbf33560b84","repo":"junit-team/junit5","slug":"cannot-override-the-standard-style-none","errorCode":null,"errorMessage":"Cannot override the standard style 'NONE'","messagePattern":"Cannot override the standard style 'NONE'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"junit-platform-console/src/main/java/org/junit/platform/console/output/ColorPalette.java","lineNumber":76,"sourceCode":"\tprivate static Map<Style, String> singleColorPalette() {\n\t\tMap<Style, String> colorsToAnsiSequences = new EnumMap<>(Style.class);\n\t\tcolorsToAnsiSequences.put(Style.NONE, \"0\");\n\t\tcolorsToAnsiSequences.put(Style.SUCCESSFUL, \"1\");\n\t\tcolorsToAnsiSequences.put(Style.ABORTED, \"4\");\n\t\tcolorsToAnsiSequences.put(Style.FAILED, \"7\");\n\t\tcolorsToAnsiSequences.put(Style.SKIPPED, \"9\");\n\t\tcolorsToAnsiSequences.put(Style.CONTAINER, \"1\");\n\t\tcolorsToAnsiSequences.put(Style.TEST, \"0\");\n\t\tcolorsToAnsiSequences.put(Style.DYNAMIC, \"0\");\n\t\tcolorsToAnsiSequences.put(Style.REPORTED, \"2\");\n\t\treturn colorsToAnsiSequences;\n\t}\n\n\tColorPalette(Map<Style, String> overrides) {\n\t\tthis(defaultPalette(), false);\n\n\t\tif (overrides.containsKey(Style.NONE)) {\n\t\t\tthrow new IllegalArgumentException(\"Cannot override the standard style 'NONE'\");\n\t\t}\n\t\tthis.colorsToAnsiSequences.putAll(overrides);\n\t}\n\n\tColorPalette(Properties properties) {\n\t\tthis(toOverrideMap(properties));\n\t}\n\n\tColorPalette(Reader reader) {\n\t\tthis(getProperties(reader));\n\t}\n\n\tpublic ColorPalette(Path path) {\n\t\tthis(getProperties(path));\n\t}\n\n\tprivate ColorPalette(Map<Style, String> colorsToAnsiSequences, boolean disableAnsiColors) {\n\t\tthis.colorsToAnsiSequences = colorsToAnsiSequences;","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-platform-console/src/main/java/org/junit/platform/console/output/ColorPalette.java#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the 'NONE=' line from your palette properties file.","When building overrides programmatically, filter out Style.NONE: overrides.remove(Style.NONE) or skip it in the builder loop.","Leave NONE unset — it always maps to the ANSI reset sequence '0'."],"exampleFix":"# before (palette.properties)\nNONE=1\nSUCCESSFUL=2\n# after\nSUCCESSFUL=2","handlingStrategy":"validation","validationCode":"// Before building a palette, strip the reserved NONE key from overrides.\nimport java.util.*;\nimport org.junit.platform.console.output.*; // Style, ColorPalette\nMap<Style,String> overrides = loadUserOverrides();\noverrides.remove(Style.NONE); // never override the reset style\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not include 'NONE' in any palette properties file.","When programmatically building overrides, iterate a filtered set that excludes Style.NONE.","Document NONE as reserved in your team's palette template."],"tags":["color-palette","ansi","configuration","console-launcher"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}