ruvnet/RuView · error

Circle requires 3 values: center_x,center_y,radius (got {})

Error message

Circle requires 3 values: center_x,center_y,radius (got {})

What it means

parse_bounds in the survivors command rejects a circle zone whose --bounds string does not contain exactly 3 comma-separated f64 values (center_x,center_y,radius). As with the rectangle branch, values must already parse as f64; this bail fires only when the arity is wrong.

Source

Thrown at v2/crates/wifi-densepose-cli/src/mat.rs:820

        .map(|s| s.trim().parse::<f64>())
        .collect::<std::result::Result<Vec<_>, _>>()
        .context("Failed to parse bounds values as numbers")?;

    match zone_type {
        ZoneType::Rectangle => {
            if parts.len() != 4 {
                anyhow::bail!(
                    "Rectangle requires 4 values: min_x,min_y,max_x,max_y (got {})",
                    parts.len()
                );
            }
            Ok(ZoneBounds::rectangle(
                parts[0], parts[1], parts[2], parts[3],
            ))
        }
        ZoneType::Circle => {
            if parts.len() != 3 {
                anyhow::bail!(
                    "Circle requires 3 values: center_x,center_y,radius (got {})",
                    parts.len()
                );
            }
            Ok(ZoneBounds::circle(parts[0], parts[1], parts[2]))
        }
    }
}

/// Execute the survivors command
async fn execute_survivors(args: SurvivorsArgs) -> Result<()> {
    // Demo data
    let survivors = vec![
        SurvivorRow {
            id: "SURV-001".to_string(),
            zone: "Zone A".to_string(),
            triage: format_triage(&TriageStatus::Immediate),
            status: "Active".green().to_string(),

View on GitHub (pinned to 4685618388)

Solutions

  1. Count the comma-separated values: a circle needs exactly center_x,center_y,radius
  2. Use the 4-value min_x,min_y,max_x,max_y form only with the rectangle zone type
  3. Quote the whole bounds string as a single shell argument
  4. Check the radius is positive after fixing the count — a non-positive radius yields an empty zone

Example fix

// before
$ ruview survivors --type circle --bounds '0,0,10,10'

// after
$ ruview survivors --type circle --bounds '5,5,3'
Defensive patterns

Strategy: validation

Validate before calling

fn circle_bounds_ok(bounds: &str) -> bool {
    bounds
        .split(',')
        .filter(|s| s.trim().parse::<f64>().is_ok())
        .count()
        == 3
}

Type guard

enum ZoneSpec {
    Rect([f64; 4]),
    Circle([f64; 3]),
}

fn parse_zone_spec(kind: &str, bounds: &str) -> Option<ZoneSpec> {
    let v: Vec<f64> = bounds
        .split(',')
        .map(|s| s.trim().parse())
        .collect::<Result<_, _>>()
        .ok()?;
    match (kind, v.as_slice()) {
        ("rectangle", [a, b, c, d]) => Some(ZoneSpec::Rect([*a, *b, *c, *d])),
        ("circle", [a, b, r]) => Some(ZoneSpec::Circle([*a, *b, *r])),
        _ => None,
    }
}

Prevention

When it happens

Trigger: Passing --bounds '0,0,10,10' (4 values) with a circle zone type; copy-pasting rectangle syntax (4 values) for a circle.

Common situations: Switching a zone from rectangle to circle in a config without updating the bounds string; hand-authored zone definitions in automation scripts.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/f238ca206e9a0672. Report an issue: GitHub.