{"record":{"id":"7549826ffb3c58c1","repo":"jdx/mise","slug":"agent-agent-name-start-calendar-interval-fie","errorCode":null,"errorMessage":"agent '{agent_name}' `start_calendar_interval.{field}` must be between {min} and {max}","messagePattern":"agent '(.+?)' `start_calendar_interval\\.(.+?)` must be between (.+?) and (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/launchd.rs","lineNumber":212,"sourceCode":"                    interval.validate(agent_name)?;\n                }\n                Ok(())\n            }\n        }\n    }\n}\n\nfn validate_range(\n    agent_name: &str,\n    field: &str,\n    value: Option<u8>,\n    min: u8,\n    max: u8,\n) -> Result<()> {\n    if let Some(value) = value\n        && !(min..=max).contains(&value)\n    {\n        bail!(\n            \"agent '{agent_name}' `start_calendar_interval.{field}` must be between {min} and {max}\"\n        );\n    }\n    Ok(())\n}\n\nimpl std::fmt::Display for LaunchdRequest {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"{} ({})\", self.name, self.label)\n    }\n}\n\npub(crate) fn is_available() -> bool {\n    cfg!(target_os = \"macos\") && crate::file::which(\"launchctl\").is_some()\n}\n\npub(crate) fn unavailable_reason() -> String {\n    if cfg!(target_os = \"macos\") {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/launchd.rs#L194-L230","documentation":"This error is thrown by validate_range while validating a launchd agent's start_calendar_interval entry. launchd restricts each calendar field (minute, hour, day, weekday, month) to a fixed numeric range, and the configured value fell outside that range. It is a user-facing config validation guard so the bad value is rejected before a plist is written and launchctl fails later.","triggerScenarios":"Calling validate (via the launchd agent apply path) with a start_calendar_interval field whose u8 value is < min or > max for that field, e.g. minute: 60 (valid 0-59), hour: 24 (valid 0-23), day: 32, weekday: 8, month: 13.","commonSituations":"Hand-edited config where the author confuses 1-based vs 0-based fields (month 1-12, weekday 0-7 in launchd), copy-pasting cron values that permit 0-6 weekdays, or generating schedules programmatically and off-by-one errors.","solutions":["Fix the out-of-range field in the agent's start_calendar_interval config to be within launchd's documented range (minute 0-59, hour 0-23, day 1-31, weekday 0-7, month 1-12).","If you intended a wildcard, omit the field entirely instead of using an out-of-range sentinel value.","If generating values in code, clamp/validate them before writing the config.","Re-run the apply/validate command to confirm the value passes."],"exampleFix":"// before\n[[start_calendar_interval]]\nminute = 61\n// after\n[[start_calendar_interval]]\nminute = 59","handlingStrategy":"validation","validationCode":"const RANGES: &[(&str, u8, u8)] = &[\n    (\"minute\", 0, 59), (\"hour\", 0, 23), (\"day\", 1, 31),\n    (\"weekday\", 0, 7), (\"month\", 1, 12),\n];\nfn validate_schedule(entry: &Schedule) -> Result<(), String> {\n    for (field, min, max) in RANGES {\n        if let Some(v) = entry.get(field) {\n            if *v < *min || *v > *max {\n                return Err(format!(\"{} must be between {} and {}\", field, min, max));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize/annotate launchd field ranges: minute 0-59, hour 0-23, day 1-31, weekday 0-7, month 1-12.","Validate schedule values in CI before deploying agent configs.","Prefer omitting fields (wildcards) over sentinel out-of-range values."],"tags":["launchd","config-validation","range-check"],"backgroundTag":"value-out-of-range","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}