{"record":{"id":"1cbd45954ced8fc8","repo":"testcontainers/testcontainers-java","slug":"a-github-issue-url-must-be-set-for-usages-of-the-flaky","errorCode":null,"errorMessage":"A GitHub issue URL must be set for usages of the @Flaky annotation","messagePattern":"A GitHub issue URL must be set for usages of the @Flaky annotation","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"test-support/src/main/java/org/testcontainers/testsupport/FlakyTestJUnit4RetryRule.java","lineNumber":42,"sourceCode":" *     accompanied by a GitHub issue URL, and should be subject to review at a suitable point in the (near) future.\n *     Should the review date pass without the test's instability being fixed, the retry behaviour will cease to have an\n *     effect and the test will be allowed to sporadically fail again.\n * </p>\n */\n@Slf4j\npublic class FlakyTestJUnit4RetryRule implements TestRule {\n\n    @Override\n    public Statement apply(Statement base, Description description) {\n        final Flaky annotation = description.getAnnotation(Flaky.class);\n\n        if (annotation == null) {\n            // leave the statement as-is\n            return base;\n        }\n\n        if (annotation.githubIssueUrl().trim().length() == 0) {\n            throw new IllegalArgumentException(\"A GitHub issue URL must be set for usages of the @Flaky annotation\");\n        }\n\n        final int maxTries = annotation.maxTries();\n\n        if (maxTries < 1) {\n            throw new IllegalArgumentException(\"@Flaky annotation maxTries must be at least one\");\n        }\n\n        final LocalDate reviewDate;\n        try {\n            reviewDate = LocalDate.parse(annotation.reviewDate());\n        } catch (DateTimeParseException e) {\n            throw new IllegalArgumentException(\n                \"@Flaky reviewDate could not be parsed. Please provide a date in yyyy-mm-dd format\"\n            );\n        }\n\n        // the annotation should only have an effect before the review date, to encourage review and resolution","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/test-support/src/main/java/org/testcontainers/testsupport/FlakyTestJUnit4RetryRule.java#L24-L60","documentation":"FlakyTestJUnit4RetryRule.apply() validates every @Flaky annotation: a non-empty githubIssueUrl is mandatory so flaky tests are tracked. If the URL is blank, it throws IllegalArgumentException immediately at rule application time.","triggerScenarios":"Annotating a test with @Flaky while omitting githubIssueUrl or passing an empty/whitespace string.","commonSituations":"Developers adding @Flaky quickly to unblock CI without filing the tracking issue; annotation template filled partially; refactors removing the URL.","solutions":["Add the tracking GitHub issue URL to the @Flaky annotation","Remove the @Flaky annotation if the test is not actually flaky","File the issue first, then annotate the test with its URL"],"exampleFix":"// before\n@Flaky(maxTries = 3)\n// after\n@Flaky(githubIssueUrl = \"https://github.com/org/repo/issues/123\", maxTries = 3)","handlingStrategy":"validation","validationCode":"Flaky flaky = m.getAnnotation(Flaky.class);\nif (flaky != null && flaky.githubIssueUrl().isBlank()) throw new IllegalStateException(\"@Flaky requires githubIssueUrl\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never add @Flaky without filing and linking an issue","Use an annotation-processor or ArchUnit-style test to lint @Flaky usage","Code-review checklist item: @Flaky must carry a URL"],"tags":["test-support","junit","annotation-validation"],"backgroundTag":"missing-required-argument","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"}