testcontainers/testcontainers-java · error · IllegalArgumentException

@Flaky reviewDate could not be parsed. Please provide a…

Error message

@Flaky reviewDate could not be parsed. Please provide a date in yyyy-mm-dd format

What it means

FlakyTestJUnit4RetryRule parses reviewDate as an ISO local date (yyyy-mm-dd). If LocalDate.parse fails with DateTimeParseException, it throws IllegalArgumentException asking for the yyyy-mm-dd format. The review date enforces periodic re-evaluation of flaky tests.

Solutions

  1. Use strict ISO format yyyy-mm-dd, e.g. 2026-12-31
  2. Zero-pad month and day (2026-03-05, not 2026-3-5)
  3. Remove reviewDate if the annotation allows omitting it

Example fix

// before
@Flaky(githubIssueUrl = "...", reviewDate = "12/31/2026")
// after
@Flaky(githubIssueUrl = "...", reviewDate = "2026-12-31")
Defensive patterns

Strategy: validation

Validate before calling

LocalDate.parse(flaky.reviewDate()); // throws DateTimeParseException early in a unit test of your annotations

Try / catch

try { LocalDate d = LocalDate.parse(reviewDate); } catch (DateTimeParseException e) { /* fix to yyyy-mm-dd */ }

Prevention

When it happens

Trigger: @Flaky(reviewDate = ...) given a non-ISO format such as '01/02/2026', '2026-1-5', or an invalid date like '2026-02-30'.

Common situations: US-style date entry (mm/dd/yyyy); missing zero padding; typos in month/day; localization-driven formats.

Related errors


AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12). Data as JSON: /api/errors/d73ae09b7e003bf0. Report an issue: GitHub.

Appendix: source

Thrown at test-support/src/main/java/org/testcontainers/testsupport/FlakyTestJUnit4RetryRule.java:55

            // leave the statement as-is
            return base;
        }

        if (annotation.githubIssueUrl().trim().length() == 0) {
            throw new IllegalArgumentException("A GitHub issue URL must be set for usages of the @Flaky annotation");
        }

        final int maxTries = annotation.maxTries();

        if (maxTries < 1) {
            throw new IllegalArgumentException("@Flaky annotation maxTries must be at least one");
        }

        final LocalDate reviewDate;
        try {
            reviewDate = LocalDate.parse(annotation.reviewDate());
        } catch (DateTimeParseException e) {
            throw new IllegalArgumentException(
                "@Flaky reviewDate could not be parsed. Please provide a date in yyyy-mm-dd format"
            );
        }

        // the annotation should only have an effect before the review date, to encourage review and resolution
        if (LocalDate.now().isBefore(reviewDate)) {
            return new RetryingStatement(base, description, maxTries);
        } else {
            return base;
        }
    }

    private static class RetryingStatement extends Statement {

        private final Statement base;

        private final Description description;

View on GitHub (pinned to 8e549514e3)