{"id":"1d93ff3e73635dec","repo":"junit-team/junit5","slug":"unsupported-argument-count-validation-mode-mode","errorCode":null,"errorMessage":"Unsupported argument count validation mode: <mode>","messagePattern":"Unsupported argument count validation mode: <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/956246301e03d757539f7b76dd5a91f298637563/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java#L34-L70","documentation":"Thrown by ArgumentCountValidator.validate() when the resolved ArgumentCountValidationMode is not DEFAULT, NONE, or STRICT. The enum has exactly three values and all are handled (DEFAULT and NONE share a case, STRICT has its own), so this default branch is effectively unreachable defensive code that guards against future enum additions.","triggerScenarios":"Calling validate() with an ArgumentCountValidationMode value outside the three defined enum constants. Since the enum is closed with exactly DEFAULT, NONE, and STRICT, no standard value reaches this branch.","commonSituations":"Practically never encountered by end users. Would only surface if a future JUnit version added a new ArgumentCountValidationMode without updating the switch.","solutions":["This error should not occur under normal usage; verify there is no version mismatch between junit-jupiter-params and junit-jupiter-engine","If it appears, file a bug — the switch in ArgumentCountValidator is missing a case for a new enum value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// No user validation needed — the enum has exactly 3 values, all handled.\n// This branch is unreachable defensive code.\nSet<ArgumentCountValidationMode> valid =\n    EnumSet.of(ArgumentCountValidationMode.DEFAULT,\n               ArgumentCountValidationMode.NONE,\n               ArgumentCountValidationMode.STRICT);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["No prevention needed — this error is unreachable with the current ArgumentCountValidationMode enum","Report it as a JUnit bug if it appears, indicating a version mismatch"],"tags":["parameterized-test","internal-assertion","unreachable","junit-jupiter-params"],"analyzedSha":"956246301e03d757539f7b76dd5a91f298637563","analyzedAt":"2026-08-04T19:25:17.049Z","schemaVersion":2}