junit-team/junit5 · error · JUnitException

Parameter resolution is disabled

Error message

Parameter resolution is disabled

What it means

Thrown by the DISABLED singleton ParameterResolver inside ArgumentSetLifecycleMethod when its resolve() method is called. This resolver's supports() always returns false, so resolve() should never be invoked — its sole purpose is to act as a sentinel that prevents parameter resolution for argument-set-level lifecycle methods (like @BeforeEach methods in a @ParameterizedClass context where per-argument-set resolution is not active). Reaching this error means the framework's supports/resolve contract was violated internally.

Source

Thrown at junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentSetLifecycleMethod.java:49

	}

	ArgumentSetLifecycleMethod(Method method, ParameterResolver parameterResolver) {
		this.method = Preconditions.notNull(method, "method must not be null");
		this.parameterResolver = Preconditions.notNull(parameterResolver, "parameterResolver must not be null");
	}

	interface ParameterResolver {

		ParameterResolver DISABLED = new ParameterResolver() {
			@Override
			public boolean supports(ParameterContext parameterContext) {
				return false;
			}

			@Override
			public Object resolve(ParameterContext parameterContext, ExtensionContext extensionContext,
					EvaluatedArgumentSet arguments, int invocationIndex, ResolutionCache resolutionCache) {
				throw new JUnitException("Parameter resolution is disabled");
			}
		};

		boolean supports(ParameterContext parameterContext);

		@Nullable
		Object resolve(ParameterContext parameterContext, ExtensionContext extensionContext,
				EvaluatedArgumentSet arguments, int invocationIndex, ResolutionCache resolutionCache);

	}
}

View on GitHub (pinned to f070c699a0)

Solutions

  1. If writing a custom extension, always check ParameterResolver.supports() before calling resolve()
  2. Report as a JUnit internal bug if encountered without custom extensions
Defensive patterns

Strategy: validation

Validate before calling

// No user-facing validation — this error indicates an internal contract violation.
// Ensure any custom extension checks supports() before calling resolve():

if (parameterResolver.supports(parameterContext)) {
    Object value = parameterResolver.resolve(parameterContext, extensionContext, arguments, index, cache);
} else {
    // handle unsupported parameter
}

Prevention

When it happens

Trigger: A lifecycle method (e.g., @BeforeEach) associated with a @ParameterizedClass argument set attempts to resolve parameters when the DISABLED resolver is bound. This should not happen through normal annotation usage because supports() returns false. It would only fire if custom extension code bypassed the supports() check.

Common situations: Unreachable through standard JUnit usage. Would indicate a framework-internal bug where a parameter is being resolved without first checking supports(). Developers writing extensions that manually call resolve() without checking supports() first might trigger it.

Related errors


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