{"record":{"id":"e3c6585f59570160","repo":"testcontainers/testcontainers-java","slug":"flaky-annotated-test-failed-despite-retries","errorCode":null,"errorMessage":"@Flaky-annotated test failed despite retries.","messagePattern":"@Flaky-annotated test failed despite retries\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"test-support/src/main/java/org/testcontainers/testsupport/FlakyTestJUnit4RetryRule.java","lineNumber":97,"sourceCode":"            this.maxTries = maxTries;\n        }\n\n        @Override\n        public void evaluate() {\n            int attempts = 0;\n            final List<Throwable> causes = new ArrayList<>();\n\n            while (++attempts <= maxTries) {\n                try {\n                    base.evaluate();\n                    return;\n                } catch (Throwable throwable) {\n                    log.warn(\"Retrying @Flaky-annotated test: {}\", description.getDisplayName());\n                    causes.add(throwable);\n                }\n            }\n\n            throw new IllegalStateException(\n                \"@Flaky-annotated test failed despite retries.\",\n                new MultipleFailureException(causes)\n            );\n        }\n    }\n}\n","sourceCodeStart":79,"sourceCodeEnd":104,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/test-support/src/main/java/org/testcontainers/testsupport/FlakyTestJUnit4RetryRule.java#L79-L104","documentation":"After exhausting all retry attempts for an @Flaky-annotated test, FlakyTestJUnit4RetryRule.evaluate() throws IllegalStateException ('@Flaky-annotated test failed despite retries.') wrapping a MultipleFailureException of every attempt's cause. It means the test genuinely failed on every allowed retry.","triggerScenarios":"A test annotated @Flaky fails maxTries times in a row — the flakiness has become a deterministic failure or the underlying issue worsened.","commonSituations":"A flaky test regressed into a hard failure; environment-dependent flakiness (port conflicts, timing) persists across retries; maxTries set too low for real intermittency.","solutions":["Read the aggregated causes in MultipleFailureException to find the consistent root failure","Fix the underlying test/product bug — it is no longer intermittent","File/move the GitHub issue referenced by @Flaky to a bug","Increase maxTries only if evidence shows failures are still intermittent"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { rule.apply(base, description).evaluate(); } catch (IllegalStateException e) { Throwable aggregated = e.getCause(); /* MultipleFailureException: inspect each attempt */ }","preventionTips":["Treat this as a real bug, not flakiness — the test failed every retry","Read all aggregated causes, not just the first","Keep @Flaky annotations reviewed before their reviewDate expires"],"tags":["test-support","junit","flaky-test","retries-exhausted"],"backgroundTag":"retry-exhausted","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}