kestra-io/kestra · error · IllegalArgumentException

Period must be positive

Error message

Period must be positive

What it means

Error "Period must be positive" thrown in kestra-io/kestra.

Source

Thrown at core/src/main/java/io/kestra/core/reporter/Schedules.java:23

import io.kestra.core.reporter.Reportable.ReportingSchedule;

/**
 * Utility class providing common implementations of {@link Reportable.ReportingSchedule}.
 */
public class Schedules {

    /**
     * Creates a reporting schedule that triggers after the specified period has elapsed
     * since the last execution.
     *
     * @param period the duration between successive runs; must be positive
     * @return a {@link Reportable.ReportingSchedule} that runs at the given interval
     * @throws IllegalArgumentException if {@code period} is zero or negative
     */
    public static ReportingSchedule every(final Duration period) {
        if (period.isZero() || period.isNegative()) {
            throw new IllegalArgumentException("Period must be positive");
        }

        return new ReportingSchedule() {
            private Instant lastRun = Instant.EPOCH;

            @Override
            public boolean shouldRun(Instant now) {
                if (Duration.between(lastRun, now).compareTo(period) >= 0) {
                    lastRun = now;
                    return true;
                }
                return false;
            }
        };
    }

    /**
     * Creates a reporting schedule that triggers once every hour.

View on GitHub (pinned to 823fada927)

Solutions

  1. Provide a positive period (e.g. PT1M, P1D); zero or negative periods are not allowed.

When it happens

Trigger: Thrown at core/src/main/java/io/kestra/core/reporter/Schedules.java:23 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14). Data as JSON: /api/errors/8c2fbe89fba79d27. Report an issue: GitHub.