{"record":{"id":"8c2fbe89fba79d27","repo":"kestra-io/kestra","slug":"period-must-be-positive","errorCode":null,"errorMessage":"Period must be positive","messagePattern":"Period must be positive","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/reporter/Schedules.java","lineNumber":23,"sourceCode":"\nimport io.kestra.core.reporter.Reportable.ReportingSchedule;\n\n/**\n * Utility class providing common implementations of {@link Reportable.ReportingSchedule}.\n */\npublic class Schedules {\n\n    /**\n     * Creates a reporting schedule that triggers after the specified period has elapsed\n     * since the last execution.\n     *\n     * @param period the duration between successive runs; must be positive\n     * @return a {@link Reportable.ReportingSchedule} that runs at the given interval\n     * @throws IllegalArgumentException if {@code period} is zero or negative\n     */\n    public static ReportingSchedule every(final Duration period) {\n        if (period.isZero() || period.isNegative()) {\n            throw new IllegalArgumentException(\"Period must be positive\");\n        }\n\n        return new ReportingSchedule() {\n            private Instant lastRun = Instant.EPOCH;\n\n            @Override\n            public boolean shouldRun(Instant now) {\n                if (Duration.between(lastRun, now).compareTo(period) >= 0) {\n                    lastRun = now;\n                    return true;\n                }\n                return false;\n            }\n        };\n    }\n\n    /**\n     * Creates a reporting schedule that triggers once every hour.","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/reporter/Schedules.java#L5-L41","documentation":"Error \"Period must be positive\" thrown in kestra-io/kestra.","triggerScenarios":"Thrown at core/src/main/java/io/kestra/core/reporter/Schedules.java:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a positive period (e.g. PT1M, P1D); zero or negative periods are not allowed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}