{"record":{"id":"56a7b19e70853a0c","repo":"junit-team/junit5","slug":"could-not-open-color-palette-properties-file","errorCode":null,"errorMessage":"Could not open color palette properties file","messagePattern":"Could not open color palette properties file","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"junit-platform-console/src/main/java/org/junit/platform/console/output/ColorPalette.java","lineNumber":122,"sourceCode":"\t}\n\n\tprivate static Properties getProperties(Reader reader) {\n\t\tProperties properties = new Properties();\n\t\ttry {\n\t\t\tproperties.load(reader);\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new IllegalArgumentException(\"Could not read color palette properties\", e);\n\t\t}\n\t\treturn properties;\n\t}\n\n\tprivate static Properties getProperties(Path path) {\n\t\ttry (FileReader fileReader = new FileReader(path.toFile(), StandardCharsets.UTF_8)) {\n\t\t\treturn getProperties(fileReader);\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new IllegalArgumentException(\"Could not open color palette properties file\", e);\n\t\t}\n\t}\n\n\tpublic String paint(Style style, String text) {\n\t\treturn this.disableAnsiColors || style == Style.NONE ? text\n\t\t\t\t: getAnsiFormatter(style) + text + getAnsiFormatter(Style.NONE);\n\t}\n\n\tprivate String getAnsiFormatter(Style style) {\n\t\treturn \"\\u001B[%sm\".formatted(this.colorsToAnsiSequences.get(style));\n\t}\n\n}\n","sourceCodeStart":104,"sourceCodeEnd":136,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-platform-console/src/main/java/org/junit/platform/console/output/ColorPalette.java#L104-L136","documentation":"ColorPalette.getProperties(Path) opens the palette properties file via FileReader. If the file does not exist, is a directory, or cannot be read, an IOException is wrapped as IllegalArgumentException. This is the file-open failure; the read/parse failure is a separate message (109).","triggerScenarios":"Passing --color-palette a path that does not exist, points to a directory, or is unreadable due to permissions. FileReader construction fails before any properties parsing.","commonSituations":"Typo in the palette file path; relative path resolved against an unexpected working directory; file deleted or moved between config time and run; permissions stripped (e.g. containerized run as a different user).","solutions":["Verify the path exists and is a regular file: Files.isRegularFile(path) && Files.isReadable(path).","Use an absolute path to avoid working-directory ambiguity.","Fix permissions/ownership so the process can read the file, or run as the appropriate user.","If the palette is optional, drop --color-palette to fall back to the default palette."],"exampleFix":"# before\njava -jar junit-platform-console-standalone.jar execute --color-palette ./missing.properties\n# after\nls /home/me/palette.properties  # confirm it exists\njava -jar junit-platform-console-standalone.jar execute --color-palette /home/me/palette.properties","handlingStrategy":"validation","validationCode":"// Before passing --color-palette, confirm the file exists and is readable.\nimport java.nio.file.*;\nPath p = Paths.get(palettePath);\nif (!Files.isRegularFile(p)) throw new IllegalArgumentException(\"palette file missing or not a regular file: \" + p);\nif (!Files.isReadable(p))  throw new IllegalArgumentException(\"palette file not readable: \" + p);\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use an absolute path for --color-palette.","Confirm file permissions for the user the launcher runs as (especially in containers).","If the palette is optional, omit --color-palette to use the default."],"tags":["color-palette","configuration","filesystem","console-launcher"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}