junit-team/junit5 · error · JUnitException
No TestEngine ID matched the following include EngineFilters
Error message
No TestEngine ID matched the following include EngineFilters:
What it means
Thrown by EngineFilterer.checkNoUnmatchedIncludeFilter() during discovery sanity checks when an include EngineFilter names one or more engine IDs that do not match any registered TestEngine. The launcher aborts rather than silently running no engines, listing the unmatched IDs and the registered engines/filters.
Source
Thrown at junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineFilterer.java:67
checkedTestEngines.put(testEngine, excluded);
return excluded;
}
void performSanityChecks() {
checkNoUnmatchedIncludeFilter();
warnIfAllEnginesExcluded();
}
private void warnIfAllEnginesExcluded() {
if (!checkedTestEngines.isEmpty() && checkedTestEngines.values().stream().allMatch(excluded -> excluded)) {
logger.warn(() -> "All TestEngines were excluded by EngineFilters.\n" + getStateDescription());
}
}
private void checkNoUnmatchedIncludeFilter() {
SortedSet<String> unmatchedEngineIdsOfIncludeFilters = getUnmatchedEngineIdsOfIncludeFilters();
if (!unmatchedEngineIdsOfIncludeFilters.isEmpty()) {
throw new JUnitException("No TestEngine ID matched the following include EngineFilters: "
+ unmatchedEngineIdsOfIncludeFilters + ".\n" //
+ "Please fix/remove the filter or add the engine.\n" //
+ getStateDescription());
}
}
private SortedSet<String> getUnmatchedEngineIdsOfIncludeFilters() {
Set<String> checkedTestEngineIds = checkedTestEngines.keySet().stream() //
.map(TestEngine::getId) //
.collect(toSet());
return engineFilters.stream() //
.filter(EngineFilter::isIncludeFilter) //
.map(EngineFilter::getEngineIds) //
.flatMap(Collection::stream) //
.filter(id -> !checkedTestEngineIds.contains(id)) //
.collect(toCollection(TreeSet::new));
}
View on GitHub (pinned to 956246301e)
Solutions
- Verify every engine ID in includeEngines(...) corresponds to a TestEngine on the classpath.
- Remove the unmatched ID from the include filter.
- Add the missing engine dependency (e.g. the Spek/Kotest launcher artifact) to the test runtime classpath.
- Inspect the exception message: it lists registered TestEngines and registered EngineFilters.
Example fix
// before
.filters(includeEngines("junit-jupiter", "spek")) // spek absent
// after
.filters(includeEngines("junit-jupiter")) Defensive patterns
Strategy: validation
Validate before calling
import org.junit.platform.engine.TestEngine;
Set<String> available = ServiceLoader.load(TestEngine.class)
.stream().map(p -> p.get().getId()).collect(toSet());
for (String id : requestedIncludeEngineIds) {
if (!available.contains(id)) {
throw new IllegalArgumentException("Unknown engine id: " + id);
}
} Type guard
static boolean allIncludeIdsResolvable(List<EngineFilter> filters, Set<String> engineIdsOnClasspath) {
return filters.stream().filter(EngineFilter::isIncludeFilter)
.flatMap(f -> f.getEngineIds().stream())
.allMatch(engineIdsOnClasspath::contains);
} Prevention
- Only list engine IDs in includeEngines(...) that you know are on the test runtime classpath.
- Run 'gradle dependencies'/'mvn dependency:tree' to confirm engine artifacts before configuring filters.
- When removing an engine dependency, update or drop the corresponding include filter.
When it happens
Trigger: Calling LauncherDiscoveryRequestBuilder.filters(includeEngines("junit-jupiter", "spek")) when 'spek' is not on the classpath. Or any EngineFilter with include semantics whose getEngineIds() contains an ID no registered engine provides.
Common situations: Adding an includeEngines filter for an engine whose dependency was removed or never added. Renaming/migrating engines (e.g. Spek, Kotest) and forgetting to update the filter. CI image missing an engine artifact that local builds include.
Related errors
- Invalid DiscoveryIssue.Severity '%s' set via the '%s' config
- Cannot override the standard style 'NONE'
- Could not read color palette properties
- Could not open color palette properties file
- Failed to transform configuration parameter with key '%s' an
AI-assisted analysis of junit-team/junit5@956246301e (2026-08-04).
Data as JSON: /data/errors/940aa6234ae6a0cd.json.
Report an issue: GitHub.