Hmbown/CodeWhale · error · anyhow::Error
CRON {field_name} field contains an empty list item
Error message
CRON {field_name} field contains an empty list item What it means
A comma-separated cron field contained an empty list item: each part is trimmed and checked for emptiness before range/step parsing. '1,,3', a trailing comma '1,2,', or a leading ',1' in any of the five fields triggers it.
Source
Thrown at crates/tui/src/automation_manager.rs:730
#[derive(Debug, Clone)]
struct CronField {
values: Vec<u32>,
is_wildcard: bool,
}
impl CronField {
fn parse(raw: &str, min: u32, max: u32, names: CronNameMap, field_name: &str) -> Result<Self> {
let trimmed = raw.trim();
if trimmed.is_empty() {
bail!("CRON {field_name} field must not be empty");
}
let mut values = Vec::new();
let is_wildcard = trimmed == "*";
for part in trimmed.split(',') {
let part = part.trim();
if part.is_empty() {
bail!("CRON {field_name} field contains an empty list item");
}
let (base, step) = if let Some((base, step)) = part.split_once('/') {
let step = step
.trim()
.parse::<u32>()
.with_context(|| format!("Failed to parse CRON {field_name} step"))?;
if step == 0 {
bail!("CRON {field_name} step must be >= 1");
}
(base.trim(), step)
} else {
(part, 1)
};
let range = if base == "*" {
(min, max)
} else if let Some((start, end)) = base.split_once('-') {
let start = parse_cron_atom(start.trim(), min, max, names, field_name)?;View on GitHub (pinned to 0c42157ee5)
Solutions
- Remove empty items: '1,3' not '1,,3'
- Strip trailing/leading commas before submitting
- When generating lists, filter out empty strings before joining with ','
- Dry-run the full EXPR via parse_rrule
Example fix
// before rrule = "FREQ=CRON;EXPR=0 0 12 1,,3 *" // after rrule = "FREQ=CRON;EXPR=0 0 12 1,3 *"
Defensive patterns
Strategy: validation
Validate before calling
fn cron_list_items_nonempty(expr: &str) -> bool {
expr.split_whitespace()
.all(|field| field.split(',').all(|item| !item.trim().is_empty()))
} Prevention
- Join only non-empty tokens when generating comma lists
- Reject double commas and leading/trailing commas at the form layer
- Validate the full EXPR with parse_rrule before persisting
- Trim user input around commas, then re-check for empties
When it happens
Trigger: EXPR='0 0 12 1,,3 *'; EXPR='0 9-17 * * 1,'; templated lists where a filter removed an element and left an empty slot between commas.
Common situations: Programmatically built comma lists with a trailing comma; join of an array that contains empty strings; simple typos.
Related errors
- CRON EXPR must have exactly 5 fields: minute hour day-of-mon
- Unsupported RRULE field '{key}' for CRON. Allowed: FREQ,EXPR
- CRON EXPR day-of-month/month combination can never occur
- CRON {field_name} field must not be empty
- CRON {field_name} step must be >= 1
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/b0f206273bd0e04a.
Report an issue: GitHub.