zeroclaw-labs/zeroclaw · error · anyhow::Error

Invalid weekday value: {val} (expected 0-7)

Error message

Invalid weekday value: {val} (expected 0-7)

What it means

Error "Invalid weekday value: {val} (expected 0-7)" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-runtime/src/cron/schedule.rs:137

                fields[0], fields[1], fields[2], fields[3], fields[4]
            ))
        }
        // crate-native syntax includes seconds (+ optional year)
        6 | 7 => Ok(expression.to_string()),
        _ => anyhow::bail!(
            "Invalid cron expression: {expression} (expected 5, 6, or 7 fields, got {field_count})"
        ),
    }
}

/// Translate a single numeric weekday value from standard crontab semantics
/// (0 or 7 = Sunday, 1 = Monday, …, 6 = Saturday) to cron-crate semantics
/// (1 = Sunday, 2 = Monday, …, 7 = Saturday).
fn translate_weekday_value(val: u8) -> Result<u8> {
    match val {
        0 | 7 => Ok(1), // Sunday
        1..=6 => Ok(val + 1),
        _ => anyhow::bail!("Invalid weekday value: {val} (expected 0-7)"),
    }
}

/// Enumerate the standard-crontab weekday values covered by `start-end`.
fn standard_weekday_range_values(start: u8, end: u8) -> Vec<u8> {
    // Enumerate the standard weekday values covered by the range, wrapping
    // around the week (Sun=0..=6=Sat) when `end < start` (e.g. `5-0`).
    let mut standard_days: Vec<u8> = Vec::new();
    let mut day = start;
    loop {
        standard_days.push(day);
        if day == end {
            break;
        }
        // Step through the 0..=7 numbering used by standard crontab, treating 7
        // as the Sunday alias so that a `…-7` endpoint terminates the loop.
        day = if day >= 7 { 0 } else { day + 1 };
    }

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Use a weekday value 0-7 (0 or 7 = Sunday).

When it happens

Trigger: Thrown at crates/zeroclaw-runtime/src/cron/schedule.rs:137 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/c614cf0901ae8617. Report an issue: GitHub.