{"record":{"id":"ee12ff4114cfcbc1","repo":"ruvnet/RuView","slug":"rectangle-requires-4-values-min-x-min-y-max-x-max","errorCode":null,"errorMessage":"Rectangle requires 4 values: min_x,min_y,max_x,max_y (got {})","messagePattern":"Rectangle requires 4 values: min_x,min_y,max_x,max_y \\(got (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v2/crates/wifi-densepose-cli/src/mat.rs","lineNumber":809,"sourceCode":"            println!(\"{} Zone '{}' resumed.\", \"[OK]\".green().bold(), zone.cyan());\n        }\n    }\n\n    Ok(())\n}\n\n/// Parse bounds string into ZoneBounds\nfn parse_bounds(zone_type: &ZoneType, bounds: &str) -> Result<ZoneBounds> {\n    let parts: Vec<f64> = bounds\n        .split(',')\n        .map(|s| s.trim().parse::<f64>())\n        .collect::<std::result::Result<Vec<_>, _>>()\n        .context(\"Failed to parse bounds values as numbers\")?;\n\n    match zone_type {\n        ZoneType::Rectangle => {\n            if parts.len() != 4 {\n                anyhow::bail!(\n                    \"Rectangle requires 4 values: min_x,min_y,max_x,max_y (got {})\",\n                    parts.len()\n                );\n            }\n            Ok(ZoneBounds::rectangle(\n                parts[0], parts[1], parts[2], parts[3],\n            ))\n        }\n        ZoneType::Circle => {\n            if parts.len() != 3 {\n                anyhow::bail!(\n                    \"Circle requires 3 values: center_x,center_y,radius (got {})\",\n                    parts.len()\n                );\n            }\n            Ok(ZoneBounds::circle(parts[0], parts[1], parts[2]))\n        }\n    }","sourceCodeStart":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/wifi-densepose-cli/src/mat.rs#L791-L827","documentation":"parse_bounds in the survivors command rejects a rectangle zone whose --bounds string does not contain exactly 4 comma-separated f64 values (min_x,min_y,max_x,max_y). The count check runs after every segment is parsed as f64, so a non-numeric segment fails earlier with 'Failed to parse bounds values as numbers'; this error is purely about arity.","triggerScenarios":"Passing --bounds '0,0,10' (3 values) or '0,0,10,10,2' (5 values) with a rectangle zone type; copy-pasting circle syntax (3 values) for a rectangle.","commonSituations":"Scripting the CLI with hand-typed zone strings; mixing rectangle and circle formats between configs; trailing commas (these fail float parsing first, with a different message).","solutions":["Count the comma-separated values: a rectangle needs exactly min_x,min_y,max_x,max_y","Use the 3-value center_x,center_y,radius form only with the circle zone type","Quote the whole bounds string so the shell passes it as one argument","After fixing the count, verify min < max ordering — inverted bounds are accepted but yield an empty zone"],"exampleFix":"// before\n$ ruview survivors --type rectangle --bounds '0,0,10'\n\n// after\n$ ruview survivors --type rectangle --bounds '0,0,10,10'","handlingStrategy":"validation","validationCode":"fn rectangle_bounds_ok(bounds: &str) -> bool {\n    bounds\n        .split(',')\n        .filter(|s| s.trim().parse::<f64>().is_ok())\n        .count()\n        == 4\n}","typeGuard":"enum ZoneSpec {\n    Rect([f64; 4]),\n    Circle([f64; 3]),\n}\n\nfn parse_zone_spec(kind: &str, bounds: &str) -> Option<ZoneSpec> {\n    let v: Vec<f64> = bounds\n        .split(',')\n        .map(|s| s.trim().parse())\n        .collect::<Result<_, _>>()\n        .ok()?;\n    match (kind, v.as_slice()) {\n        (\"rectangle\", [a, b, c, d]) => Some(ZoneSpec::Rect([*a, *b, *c, *d])),\n        (\"circle\", [a, b, r]) => Some(ZoneSpec::Circle([*a, *b, *r])),\n        _ => None,\n    }\n}","tryCatchPattern":null,"preventionTips":["Validate the value count in wrapper scripts before invoking the CLI","Keep one canonical bounds format per zone type in config files","Add a unit test for every zone string shipped in automation"],"tags":["rust","cli","parsing","validation","zones"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}