{"id":"8641ccfc5ae06263","repo":"junit-team/junit5","slug":"invalid-launcherphase-s-set-via-the-s-config","errorCode":null,"errorMessage":"Invalid LauncherPhase '%s' set via the '%s' configuration parameter.","messagePattern":"Invalid LauncherPhase '(.+?)' 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/LauncherPhase.java","lineNumber":38,"sourceCode":"import org.junit.platform.commons.JUnitException;\nimport org.junit.platform.engine.ConfigurationParameters;\n\n/**\n * The phase the {@link org.junit.platform.launcher.Launcher} is in.\n *\n * @since 1.13\n */\nenum LauncherPhase {\n\n\tDISCOVERY, EXECUTION;\n\n\tstatic Optional<LauncherPhase> getDiscoveryIssueFailurePhase(ConfigurationParameters configurationParameters) {\n\t\tFunction<String, @Nullable LauncherPhase> stringLauncherPhaseFunction = value -> {\n\t\t\ttry {\n\t\t\t\treturn LauncherPhase.valueOf(value.toUpperCase(Locale.ROOT));\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tthrow new JUnitException(\n\t\t\t\t\t\"Invalid LauncherPhase '%s' set via the '%s' configuration parameter.\".formatted(value,\n\t\t\t\t\t\tDISCOVERY_ISSUE_FAILURE_PHASE_PROPERTY_NAME));\n\t\t\t}\n\t\t};\n\t\treturn configurationParameters.get(DISCOVERY_ISSUE_FAILURE_PHASE_PROPERTY_NAME, stringLauncherPhaseFunction);\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\treturn name().toLowerCase(Locale.ENGLISH);\n\t}\n}\n","sourceCodeStart":20,"sourceCodeEnd":51,"githubUrl":"https://github.com/junit-team/junit5/blob/956246301e03d757539f7b76dd5a91f298637563/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherPhase.java#L20-L51","documentation":"Thrown by LauncherPhase.getDiscoveryIssueFailurePhase() when the configuration parameter DISCOVERY_ISSUE_FAILURE_PHASE_PROPERTY_NAME cannot be parsed into a LauncherPhase enum value. The value is uppercased and passed to LauncherPhase.valueOf(); valid constants are DISCOVERY and EXECUTION. Any other value raises a JUnitException.","triggerScenarios":"Setting junit.platform.launcher.discoveryIssue.failurePhase (per the constant) to something other than 'discovery' or 'execution', e.g. 'both', 'runtime', 'test'. Configured via configurationParameter(), junit-platform.properties, or system property.","commonSituations":"Typos in junit-platform.properties. Guessing a phase name. Documentation drift between JUnit versions where the property name or allowed values changed.","solutions":["Use exactly 'discovery' or 'execution' (case-insensitive) for the property value.","Remove the property to use the default behaviour.","Cross-check LauncherPhase enum and DISCOVERY_ISSUE_FAILURE_PHASE_PROPERTY_NAME in your JUnit version."],"exampleFix":"# before\njunit.platform.launcher.discoveryIssue.failurePhase = runtime\n\n# after\njunit.platform.launcher.discoveryIssue.failurePhase = discovery","handlingStrategy":"validation","validationCode":"String value = props.getProperty(DISCOVERY_ISSUE_FAILURE_PHASE_PROPERTY_NAME);\nif (value != null) {\n    LauncherPhase.valueOf(value.toUpperCase(Locale.ROOT)); // throws early\n}","typeGuard":"static boolean isValidPhase(String v) {\n    try { LauncherPhase.valueOf(v.toUpperCase(Locale.ROOT)); return true; }\n    catch (Exception e) { return false; }\n}","tryCatchPattern":null,"preventionTips":["Only use 'discovery' or 'execution' for the failure-phase property.","Remove the property to accept defaults when unsure.","Validate junit-platform.properties values against the enum in CI."],"tags":["configuration","launcher","invalid-config","junit-platform"],"analyzedSha":"956246301e03d757539f7b76dd5a91f298637563","analyzedAt":"2026-08-04T19:25:17.049Z","schemaVersion":2}