{"id":"0edb9f12937c5d8b","repo":"junit-team/junit5","slug":"invalid-discoveryissue-severity-s-set-via-the","errorCode":null,"errorMessage":"Invalid DiscoveryIssue.Severity '%s' set via the '%s' configuration parameter.","messagePattern":"Invalid DiscoveryIssue\\.Severity '(.+?)' set via the '(.+?)' configuration parameter\\.","errorType":"exception","errorClass":"JUnitException","httpStatus":null,"severity":"error","filePath":"junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DiscoveryIssueCollector.java","lineNumber":58,"sourceCode":"\tpublic void issueEncountered(UniqueId engineId, DiscoveryIssue issue) {\n\t\tthis.issues.add(issue);\n\t}\n\n\tDiscoveryIssueNotifier toNotifier() {\n\t\tif (this.issues.isEmpty()) {\n\t\t\treturn DiscoveryIssueNotifier.NO_ISSUES;\n\t\t}\n\t\treturn DiscoveryIssueNotifier.from(criticalSeverity, this.issues);\n\t}\n\n\tprivate static Severity getCriticalSeverity(ConfigurationParameters configurationParameters) {\n\t\treturn configurationParameters //\n\t\t\t\t.get(LauncherConstants.CRITICAL_DISCOVERY_ISSUE_SEVERITY_PROPERTY_NAME, value -> {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn Severity.valueOf(value.toUpperCase(Locale.ROOT));\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception e) {\n\t\t\t\t\t\tthrow new JUnitException(\n\t\t\t\t\t\t\t\"Invalid DiscoveryIssue.Severity '%s' set via the '%s' configuration parameter.\".formatted(\n\t\t\t\t\t\t\t\tvalue, LauncherConstants.CRITICAL_DISCOVERY_ISSUE_SEVERITY_PROPERTY_NAME));\n\t\t\t\t\t}\n\t\t\t\t}) //\n\t\t\t\t.orElse(Severity.ERROR);\n\t}\n}\n","sourceCodeStart":40,"sourceCodeEnd":66,"githubUrl":"https://github.com/junit-team/junit5/blob/956246301e03d757539f7b76dd5a91f298637563/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DiscoveryIssueCollector.java#L40-L66","documentation":"Thrown by DiscoveryIssueCollector when the configuration parameter referenced by LauncherConstants.CRITICAL_DISCOVERY_ISSUE_SEVERITY_PROPERTY_NAME cannot be parsed into a DiscoveryIssue.Severity enum value. The value is uppercased and passed to Severity.valueOf(); any non-matching string raises a JUnitException wrapping the parse failure. Default severity when unset is Severity.ERROR.","triggerScenarios":"Setting junit.platform.launcher.discoveryIssue.critical.severity (or the equivalent constant) to a value that is not one of the DiscoveryIssue.Severity enum constants, e.g. 'fatal', 'critical', 'err'. Passed via configurationParameter(), junit-platform.properties, or system property.","commonSituations":"Typos in junit-platform.properties. Copying an outdated severity name from documentation. Guessing 'CRITICAL' when the enum only defines NOTICE/WARNING/ERROR. Migration between JUnit versions where severity names changed.","solutions":["Check DiscoveryIssue.Severity enum constants in your JUnit version and use an exact match (case-insensitive).","Remove the configuration parameter to fall back to the default (ERROR).","Validate the value against Severity values before deploying junit-platform.properties."],"exampleFix":"# before (junit-platform.properties)\njunit.platform.launcher.discoveryIssue.critical.severity = fatal\n\n# after\njunit.platform.launcher.discoveryIssue.critical.severity = ERROR","handlingStrategy":"validation","validationCode":"import org.junit.platform.engine.DiscoveryIssue.Severity;\nString value = props.getProperty(LauncherConstants.CRITICAL_DISCOVERY_ISSUE_SEVERITY_PROPERTY_NAME);\nif (value != null) {\n    Severity.valueOf(value.toUpperCase(Locale.ROOT)); // throws early if invalid\n}","typeGuard":"static boolean isValidSeverity(String v) {\n    try { Severity.valueOf(v.toUpperCase(Locale.ROOT)); return true; }\n    catch (Exception e) { return false; }\n}","tryCatchPattern":null,"preventionTips":["Cross-check DiscoveryIssue.Severity enum constants for your JUnit version before writing the property.","Validate junit-platform.properties in CI with a schema/enumeration check.","Leave the parameter unset to use the default (ERROR) unless you need a different threshold."],"tags":["configuration","discovery","junit-platform","invalid-config"],"analyzedSha":"956246301e03d757539f7b76dd5a91f298637563","analyzedAt":"2026-08-04T19:25:17.049Z","schemaVersion":2}