{"record":{"id":"603a4a7b21295562","repo":"junit-team/junit5","slug":"error-executing-tests-for-engine-getid","errorCode":null,"errorMessage":"Error executing tests for engine ${getId()}","messagePattern":"Error executing tests for engine (.+?)","errorType":"exception","errorClass":"JUnitException","httpStatus":null,"severity":"critical","filePath":"junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.java","lineNumber":70,"sourceCode":"\t *\n\t * <p>Supports cancellation via the {@link CancellationToken} passed in the\n\t * supplied {@code request}.\n\t *\n\t * @see Node\n\t * @see #createExecutorService\n\t * @see #createExecutionContext\n\t * @see #createThrowableCollectorFactory\n\t */\n\t@Override\n\tpublic final void execute(ExecutionRequest request) {\n\t\ttry (HierarchicalTestExecutorService executorService = createExecutorService(request)) {\n\t\t\tC executionContext = createExecutionContext(request);\n\t\t\tThrowableCollector.Factory throwableCollectorFactory = createThrowableCollectorFactory(request);\n\t\t\tnew HierarchicalTestExecutor<>(request, executionContext, executorService,\n\t\t\t\tthrowableCollectorFactory).execute().get();\n\t\t}\n\t\tcatch (Exception exception) {\n\t\t\tthrow new JUnitException(\"Error executing tests for engine \" + getId(), exception);\n\t\t}\n\t}\n\n\t/**\n\t * Create the {@linkplain HierarchicalTestExecutorService executor service}\n\t * to use for executing the supplied {@linkplain ExecutionRequest request}.\n\t *\n\t * <p>An engine may use the information in the supplied <em>request</em>\n\t * such as the contained\n\t * {@linkplain ExecutionRequest#getConfigurationParameters() configuration parameters}\n\t * to decide what kind of service to return or how to configure it.\n\t *\n\t * <p>By default, this method returns an instance of\n\t * {@link SameThreadHierarchicalTestExecutorService}.\n\t *\n\t * @param request the request about to be executed\n\t * @since 1.3\n\t * @see ForkJoinPoolHierarchicalTestExecutorService","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/junit-team/junit5/blob/f070c699a08b5d8393df9afd147af5c5e90bb21b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.java#L52-L88","documentation":"The top-level catch in HierarchicalTestEngine.execute(ExecutionRequest): any Exception escaping the executor service lifecycle, context creation, throwable-collector factory, or the executor's Future.get() is rethrown as a JUnitException with the offending engine id. It is an umbrella error: the real failure is always in the chained cause.","triggerScenarios":"createExecutorService(request) throws (e.g. error 121), createExecutionContext(request) throws, createThrowableCollectorFactory(request) throws, or HierarchicalTestExecutor.execute().get() throws an ExecutionException wrapping an internal engine failure (interrupted, OOM, lock acquisition failure, etc.).","commonSituations":"Misconfigured parallel execution causing pool creation failure; a custom HierarchicalTestEngine whose context factory throws; thread interruption during execution; an ExclusiveResource lock that deadlocks/times out; OOM during a large test graph; SPI or classpath issues loading engine internals.","solutions":["Read the chained cause (exception.getCause()) - it is the actual failure; fix that root cause first.","If the cause is a ForkJoinPool/parallel-execution failure, see error 121 fixes (check junit.execution.parallel.config.* properties).","If the cause is InterruptedException, ensure the launching thread is not interrupted and no external timeout is aborting execution.","If using a custom HierarchicalTestEngine, verify createExecutionContext/createExecutorService/createThrowableCollectorFactory do not throw on valid requests."],"exampleFix":"// before\ntry {\n    engine.execute(request);\n} catch (JUnitException e) {\n    log.error(e.getMessage()); // only sees the umbrella message\n}\n// after\ntry {\n    engine.execute(request);\n} catch (JUnitException e) {\n    Throwable root = e.getCause() != null ? e.getCause() : e;\n    log.error(\"Engine {} failed: {}\", engine.getId(), root, root);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    engine.execute(request);\n} catch (JUnitException e) {\n    Throwable root = (e.getCause() instanceof ExecutionException ee) ? ee.getCause() : e.getCause();\n    // branch on root type: config error, OOM, interrupted, etc.\n    throw root != null ? new RuntimeException(root) : e;\n}","preventionTips":["Always inspect getCause() - this is an umbrella exception.","Validate executor/context factories in custom engines with small smoke tests.","Do not interrupt the launching thread during execution."],"tags":["execution","engine","umbrella-error","parallel-execution"],"backgroundTag":null,"analyzedSha":"f070c699a08b5d8393df9afd147af5c5e90bb21b","analyzedAt":"2026-08-11T20:31:00.530Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}