ruvnet/RuView · error

invalid baseline {path}: {e}

Error message

invalid baseline {path}: {e}

What it means

The baseline file was read but BaselineCalibration::from_bytes rejected its contents. from_bytes (wifi-densepose-signal/src/ruvsense/calibration.rs:405) fails with TruncatedBuffer (below the 28-byte header or short subcarrier payload), InvalidMagic, VersionMismatch (baseline written by a different format version), or UnknownTier (bad tier byte).

Source

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

/// 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
// ---------------------------------------------------------------------------

/// Arguments for `enroll`.
#[derive(Args, Debug, Clone)]

View on GitHub (pinned to 4685618388)

Solutions

  1. Regenerate the baseline with the current build by re-running calibrate
  2. Verify you passed the binary baseline, not enrollment JSON or room-bank.json
  3. Re-transfer the file and compare sizes/checksums if it came from another host
  4. Keep baselines and the consuming binaries from the same release so the format VERSION matches
Defensive patterns

Strategy: validation

Validate before calling

fn check_baseline(path: &str) -> Result<(), String> {
    let buf = std::fs::read(path).map_err(|e| format!("read {path}: {e}"))?;
    BaselineCalibration::from_bytes(&buf).map_err(|e| format!("not a valid baseline: {e}"))
}

Type guard

fn looks_like_baseline(buf: &[u8]) -> bool {
    // header = magic(4) + version(1) + tier(1) + reserved(2) + captured_at(8) + frame_count(8) + n(4)
    buf.len() >= 28 && BaselineCalibration::from_bytes(buf).is_ok()
}

Prevention

When it happens

Trigger: Passing a non-baseline file (JSON enrollment, text log) as --baseline; a baseline truncated by a partial write or interrupted transfer; a baseline produced by an older/newer RuView build with a different format VERSION; a corrupted tier byte.

Common situations: Mixing up CLI artifact types; upgrading the toolchain and reusing old baselines; interrupted scp/rsync transfers; binary files touched by re-encoding tooling.

Related errors


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