junit-team/junit5 · error · ExtensionConfigurationException

Unsupported argument count validation mode: %s

Error message

Unsupported argument count validation mode: %s

What it means

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.

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 f070c699a0)

Solutions

  1. Ensure all JUnit Jupiter modules (engine, params, api) are at the same version
  2. If using a forked/custom ArgumentCountValidationMode, update the switch in ArgumentCountValidator to handle the new constant
  3. Report as a bug to JUnit if all modules are at the same released version
Defensive patterns

Strategy: validation

Validate before calling

// Validate that all JUnit Jupiter modules are version-aligned before running
import java.util.jar.Manifest;
import java.util.jar.JarFile;

// Check that junit-jupiter-engine and junit-jupiter-params have the same Implementation-Version
// in their MANIFEST.MF — mismatch causes switch/enum incompatibilities

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of junit-team/junit5@f070c699a0 (2026-08-11). Data as JSON: /api/errors/01419703e631042b. Report an issue: GitHub.