ruvnet/RuView · error

cannot read geometry {path}: {e}

Error message

cannot read geometry {path}: {e}

What it means

train-room failed to read the optional --geometry file (std::fs::read_to_string). It can only occur when --geometry was explicitly passed; the io::Error is usually NotFound or permission denied, i.e. a wrong or stale path in the flag.

Source

Thrown at v2/crates/wifi-densepose-cli/src/room.rs:252

}

/// Execute `train-room`.
///
/// If the enrollment session carries a transceiver-geometry snapshot (recorded
/// at enroll time or supplied here via `--geometry`), it is threaded into the
/// bank (ADR-152 §2.1.1); a geometry-free enrollment still trains a valid bank.
pub async fn train_room(args: TrainRoomArgs) -> Result<()> {
    let raw = std::fs::read_to_string(&args.enrollment)
        .map_err(|e| anyhow::anyhow!("cannot read {}: {e} — run `enroll` first", args.enrollment))?;
    let mut data: EnrollmentData =
        serde_json::from_str(&raw).map_err(|e| anyhow::anyhow!("invalid enrollment: {e}"))?;
    if data.anchors.is_empty() {
        bail!("no accepted anchors in {} — re-run enroll", args.enrollment);
    }

    if let Some(path) = &args.geometry {
        let graw = std::fs::read_to_string(path)
            .map_err(|e| anyhow::anyhow!("cannot read geometry {path}: {e}"))?;
        let geometry: Vec<NodeGeometry> = serde_json::from_str(&graw).map_err(|e| {
            anyhow::anyhow!("invalid geometry {path}: {e} (expected a JSON array of NodeGeometry records)")
        })?;
        data.session.record_geometry(geometry, now_unix());
    }

    let mut bank = SpecialistBank::train(&data.room_id, &data.baseline_id, &data.anchors, now_unix())
        .map_err(|e| anyhow::anyhow!("training failed: {e}"))?;
    match data.session.geometry() {
        Some(g) if !g.is_empty() => {
            bank = bank.with_geometry(g.to_vec());
            eprintln!(
                "[train-room] geometry: {} node(s) snapshotted into the bank (ADR-152 §2.1.1)",
                bank.geometry.len()
            );
        }
        _ => eprintln!(
            "[train-room] no transceiver geometry recorded — bank will not support geometry conditioning (ADR-152 §2.1.2)"

View on GitHub (pinned to 4685618388)

Solutions

  1. Verify the path exists and is readable
  2. Omit --geometry to train a geometry-free bank (explicitly supported per the code comment)
  3. Regenerate the geometry snapshot if the source is gone
Defensive patterns

Strategy: validation

Validate before calling

fn geometry_file_ok(path: &str) -> bool {
    std::path::Path::new(path).is_file() && std::fs::read_to_string(path).is_ok()
}

Prevention

When it happens

Trigger: Passing --geometry with a typo'd or moved path; the file deleted between enroll and train; unreadable permissions; a non-UTF-8 file at the path.

Common situations: Ops scripts referencing a geometry snapshot that moved or was renamed; assuming geometry is mandatory when the command explicitly supports a geometry-free path.

Related errors


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