ruvnet/RuView · error

cannot read baseline {path}: {e} — run `calibrate` first

Error message

cannot read baseline {path}: {e} — run `calibrate` first

What it means

load_baseline in room.rs failed to std::fs::read the --baseline file. The message appends 'run calibrate first' because the expected artifact is the binary BaselineCalibration written by the calibrate command's finalise_and_save. The io::Error is usually NotFound but can be permission denied or another OS read failure.

Source

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

}

/// Per-frame scalar: mean amplitude across all subcarriers/streams.
///
/// Carries presence/motion energy plus the breathing amplitude modulation.
/// (Validated live on the ESP32 — picks up breathing where a max-variance
/// subcarrier instead locks onto motion artifacts. A phase-based carrier on a
/// *stable* subcarrier is the proper higher-SNR refinement — ADR-151 §4.)
fn frame_scalar(frame: &CsiFrame) -> f32 {
    let a = &frame.amplitude;
    if a.is_empty() {
        return 0.0;
    }
    (a.sum() / a.len() as f64) as f32
}

fn load_baseline(path: &str) -> Result<BaselineCalibration> {
    let bytes = std::fs::read(path)
        .map_err(|e| anyhow::anyhow!("cannot read baseline {path}: {e} — run `calibrate` first"))?;
    BaselineCalibration::from_bytes(&bytes)
        .map_err(|e| anyhow::anyhow!("invalid baseline {path}: {e}"))
}

/// Persisted enrollment output (labelled features + audit log).
#[derive(serde::Serialize, serde::Deserialize)]
struct EnrollmentData {
    room_id: String,
    baseline_id: String,
    fs_hz: f32,
    anchors: Vec<AnchorFeature>,
    session: EnrollmentSession,
}

// ---------------------------------------------------------------------------
// enroll
// ---------------------------------------------------------------------------

View on GitHub (pinned to 4685618388)

Solutions

  1. Run calibrate first and use the exact path it prints ('[calibrate] baseline saved to …')
  2. Point --baseline at that binary file, not the enrollment JSON or room bank
  3. Use absolute paths or run from a fixed working directory
  4. If the file exists, fix read permissions

Example fix

// before
$ ruview enroll --baseline ./baseline.bin   # cannot read: run `calibrate` first

// after
$ ruview calibrate --output ./artifacts/baseline.bin
$ ruview enroll --baseline ./artifacts/baseline.bin
Defensive patterns

Strategy: validation

Validate before calling

fn baseline_readable(path: &str) -> bool {
    std::path::Path::new(path).is_file()
}

Try / catch

match std::fs::read(path) {
    Ok(bytes) => bytes,
    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
        return Err(anyhow::anyhow!("cannot read baseline {path}: {e} — run `calibrate` first"));
    }
    Err(e) => return Err(anyhow::anyhow!("cannot read baseline {path}: {e}")),
}

Prevention

When it happens

Trigger: Running enroll or room-watch before any calibrate run produced the baseline; --baseline pointing at a wrong path or at the JSON enrollment file instead of the binary baseline; unreadable file permissions.

Common situations: New machine or checkout without the artifacts directory; running the CLI from a different working directory so a relative baseline path misses; mixing up the binary baseline with the JSON artifacts.

Related errors


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