junit-team/junit5 · error · ExtensionConfigurationException
Unsupported argument count validation mode: <mode>
Error message
Unsupported argument count validation mode: <mode>
What it means
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.
Source
Thrown at junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java:52
ArgumentCountValidator(ParameterizedDeclarationContext<?> declarationContext, EvaluatedArgumentSet arguments) {
this.declarationContext = declarationContext;
this.arguments = arguments;
}
void validate(ExtensionContext extensionContext) {
validateRequiredArgumentsArePresent();
ArgumentCountValidationMode argumentCountValidationMode = getArgumentCountValidationMode(extensionContext);
switch (argumentCountValidationMode) {
case DEFAULT, NONE -> {
}
case STRICT -> {
int consumedCount = this.declarationContext.getResolverFacade().determineConsumedArgumentCount(
this.arguments);
int totalCount = this.arguments.getTotalLength();
Preconditions.condition(consumedCount == totalCount,
() -> wrongNumberOfArgumentsMessages("consumes", consumedCount, null, null));
}
default -> throw new ExtensionConfigurationException(
"Unsupported argument count validation mode: " + argumentCountValidationMode);
}
}
private void validateRequiredArgumentsArePresent() {
var requiredParameterCount = this.declarationContext.getResolverFacade().getRequiredParameterCount();
if (requiredParameterCount != null) {
var totalCount = this.arguments.getTotalLength();
Preconditions.condition(requiredParameterCount.value() <= totalCount,
() -> wrongNumberOfArgumentsMessages("has", requiredParameterCount.value(), "required",
requiredParameterCount.reason()));
}
}
private String wrongNumberOfArgumentsMessages(String verb, int actualCount, @Nullable String parameterAdjective,
@Nullable String reason) {
int totalCount = this.arguments.getTotalLength();
return "Configuration error: @%s %s %s %s%s%s but there %s %s %s provided.%nNote: the provided arguments were %s".formatted(View on GitHub (pinned to 956246301e)
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
Defensive patterns
Strategy: validation
Validate before calling
// No user validation needed — the enum has exactly 3 values, all handled.
// This branch is unreachable defensive code.
Set<ArgumentCountValidationMode> valid =
EnumSet.of(ArgumentCountValidationMode.DEFAULT,
ArgumentCountValidationMode.NONE,
ArgumentCountValidationMode.STRICT); Prevention
- 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
When it happens
Trigger: 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.
Common situations: Practically never encountered by end users. Would only surface if a future JUnit version added a new ArgumentCountValidationMode without updating the switch.
Related errors
- Could not map TimeUnit <unit> to ChronoUnit
- Configuration error: You must configure at least one set of
- The display name pattern defined for the parameterized test
- Failed to format display name for parameterized test. See ne
- When the display name pattern for a @%s contains %s, the arg
AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04).
Data as JSON: /data/errors/1d93ff3e73635dec.json.
Report an issue: GitHub.