{"record":{"id":"d376f79ea313b6d5","repo":"influxdata/influxdb","slug":"schedule-duration-cannot-be-greater-than-1-year","errorCode":null,"errorMessage":"schedule duration cannot be greater than 1 year","messagePattern":"schedule duration cannot be greater than 1 year","errorType":"validation","errorClass":"PluginError","httpStatus":null,"severity":"error","filePath":"influxdb3_processing_engine/src/plugins.rs","lineNumber":185,"sourceCode":"        time_provider: Arc<dyn TimeProvider>,\n    ) -> Result<Self, PluginError> {\n        match trigger_spec {\n            TriggerSpecificationDefinition::AllTablesWalWrite\n            | TriggerSpecificationDefinition::SingleTableWalWrite { .. } => {\n                Err(anyhow!(\"shouldn't have table trigger for scheduled plugin\").into())\n            }\n            TriggerSpecificationDefinition::RequestPath { .. } => {\n                Err(anyhow!(\"shouldn't have request path trigger for scheduled plugin\").into())\n            }\n            TriggerSpecificationDefinition::Schedule { schedule } => {\n                let schedule = CronSchedule::from_str(schedule.as_str())\n                    .context(\"cron schedule should be parsable\")?;\n                Ok(Self::new_cron(schedule, time_provider))\n            }\n            TriggerSpecificationDefinition::Every { duration } => {\n                // check that duration isn't longer than a year, so we avoid overflows.\n                if *duration > parse_duration(\"1 year\").unwrap() {\n                    return Err(anyhow!(\"schedule duration cannot be greater than 1 year\").into());\n                }\n                Ok(Self::new_every(\n                    Duration::from_std(*duration)\n                        .context(\"should be able to convert durations. \")?,\n                    time_provider,\n                ))\n            }\n        }\n    }\n\n    fn new_cron(cron_schedule: CronSchedule, time_provider: Arc<dyn TimeProvider>) -> Self {\n        let mut schedule = Box::new(cron_schedule.after_owned(time_provider.now().date_time()));\n        let next_trigger_time = schedule.next();\n        Self {\n            schedule: Schedule::Cron(schedule),\n            next_trigger_time,\n        }\n    }","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_processing_engine/src/plugins.rs#L167-L203","documentation":"This error is thrown when a trigger is created with an `Every { duration }` schedule whose interval exceeds one year. The check exists to prevent arithmetic overflow when computing the next trigger time in milliseconds. The trigger specification is rejected at construction time via `TriggerSpecificationDefinition::try_new`, so the trigger is never registered.","triggerScenarios":"Creating a trigger with `CREATE TRIGGER ... EVERY <duration>` where the parsed duration is greater than `parse_duration(\"1 year\")`, e.g. `EVERY 2 years` or `EVERY 400d`.","commonSituations":"Misconfigured cron replacements where a developer wants a long-lived trigger and assumes arbitrary intervals are allowed; using duration strings like '2y' in the EVERY clause; copy-pasted configs from other schedulers with unlimited intervals.","solutions":["Reduce the EVERY interval to 1 year or less (e.g. `EVERY 365d`).","Use a `cron` schedule expression instead for very long intervals — cron schedules don't have this one-year cap.","If sub-second precision isn't needed and the goal is a one-shot job, use a cron expression that fires on the desired date instead of a huge EVERY duration."],"exampleFix":"// before\nCREATE TRIGGER \"long\" ON db PROCESSING ENGINE PLUGIN my_plugin AT EVERY 2 years\n// after\nCREATE TRIGGER \"long\" ON db PROCESSING ENGINE PLUGIN my_plugin AT cron '0 0 1 1 *'","handlingStrategy":"validation","validationCode":"// Rust: before creating the trigger\nlet max = parse_duration(\"1 year\").unwrap();\nassert!(requested_duration <= max, \"EVERY duration must be <= 1 year; use cron for longer\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap generated EVERY intervals at 1 year in provisioning scripts","Prefer cron expressions for intervals beyond days","Validate trigger DDL in CI before applying to the server"],"tags":["scheduling","validation","duration","triggers"],"backgroundTag":"value-out-of-range","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}