{"record":{"id":"01419703e631042b","repo":"junit-team/junit5","slug":"unsupported-argument-count-validation-mode-s","errorCode":null,"errorMessage":"Unsupported argument count validation mode: %s","messagePattern":"Unsupported argument count validation mode: (.+?)","errorType":"exception","errorClass":"ExtensionConfigurationException","httpStatus":null,"severity":"error","filePath":"junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java","lineNumber":52,"sourceCode":"\tArgumentCountValidator(ParameterizedDeclarationContext<?> declarationContext, EvaluatedArgumentSet arguments) {\n\t\tthis.declarationContext = declarationContext;\n\t\tthis.arguments = arguments;\n\t}\n\n\tvoid validate(ExtensionContext extensionContext) {\n\t\tvalidateRequiredArgumentsArePresent();\n\t\tArgumentCountValidationMode argumentCountValidationMode = getArgumentCountValidationMode(extensionContext);\n\t\tswitch (argumentCountValidationMode) {\n\t\t\tcase DEFAULT, NONE -> {\n\t\t\t}\n\t\t\tcase STRICT -> {\n\t\t\t\tint consumedCount = this.declarationContext.getResolverFacade().determineConsumedArgumentCount(\n\t\t\t\t\tthis.arguments);\n\t\t\t\tint totalCount = this.arguments.getTotalLength();\n\t\t\t\tPreconditions.condition(consumedCount == totalCount,\n\t\t\t\t\t() -> wrongNumberOfArgumentsMessages(\"consumes\", consumedCount, null, null));\n\t\t\t}\n\t\t\tdefault -> throw new ExtensionConfigurationException(\n\t\t\t\t\"Unsupported argument count validation mode: \" + argumentCountValidationMode);\n\t\t}\n\t}\n\n\tprivate void validateRequiredArgumentsArePresent() {\n\t\tvar requiredParameterCount = this.declarationContext.getResolverFacade().getRequiredParameterCount();\n\t\tif (requiredParameterCount != null) {\n\t\t\tvar totalCount = this.arguments.getTotalLength();\n\t\t\tPreconditions.condition(requiredParameterCount.value() <= totalCount,\n\t\t\t\t() -> wrongNumberOfArgumentsMessages(\"has\", requiredParameterCount.value(), \"required\",\n\t\t\t\t\trequiredParameterCount.reason()));\n\t\t}\n\t}\n\n\tprivate String wrongNumberOfArgumentsMessages(String verb, int actualCount, @Nullable String parameterAdjective,\n\t\t\t@Nullable String reason) {\n\t\tint totalCount = this.arguments.getTotalLength();\n\t\treturn \"Configuration error: @%s %s %s %s%s%s but there %s %s %s provided.%nNote: the provided arguments were %s\".formatted(","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java#L34-L70","documentation":"Thrown from the default branch of a switch on ArgumentCountValidationMode in ArgumentCountValidator.validate(). The switch explicitly handles DEFAULT, NONE, and STRICT — any other enum value reaches the default branch. This is a defensive guard against future enum constants being added to ArgumentCountValidationMode without updating the switch, and should be unreachable with the current API surface.","triggerScenarios":"A new ArgumentCountValidationMode enum constant is added in a future JUnit version but the ArgumentCountValidator is not updated. Or a custom/forked version of the enum introduces a new value. The error surfaces at validation time during parameterized test execution.","commonSituations":"Not reachable in standard usage with JUnit 5.x as shipped. Could surface in a forked or pre-release version of JUnit where the enum has been extended. Developers mixing JUnit versions (e.g., jupiter-engine from one version with params from another) might encounter a mismatch.","solutions":["Ensure all JUnit Jupiter modules (engine, params, api) are at the same version","If using a forked/custom ArgumentCountValidationMode, update the switch in ArgumentCountValidator to handle the new constant","Report as a bug to JUnit if all modules are at the same released version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate that all JUnit Jupiter modules are version-aligned before running\nimport java.util.jar.Manifest;\nimport java.util.jar.JarFile;\n\n// Check that junit-jupiter-engine and junit-jupiter-params have the same Implementation-Version\n// in their MANIFEST.MF — mismatch causes switch/enum incompatibilities","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use a BOM (junit-bom) in your dependency management to ensure all JUnit modules are version-aligned","Run mvn dependency:tree or gradle dependencies to verify no conflicting JUnit versions are transitively pulled in"],"tags":["argument-validation","defensive-default","version-mismatch","junit-params"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}