ruvnet/RuView · error

invalid enrollment: {e}

Error message

invalid enrollment: {e}

What it means

The enrollment file was read but serde_json::from_str could not deserialize it into EnrollmentData. Causes: malformed JSON, or valid JSON whose shape does not match the schema — missing or renamed required fields (room_id, baseline_id, fs_hz, anchors, session), wrong types, or an enrollment written by an older schema.

Source

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

    #[arg(long, default_value = "./room-bank.json")]
    pub output: String,
    /// Optional transceiver-geometry file: a JSON array of `NodeGeometry`
    /// records (ADR-152 §2.1.1). Recorded into the enrollment session before
    /// training so the bank carries the layout it was trained under.
    #[arg(long)]
    pub geometry: Option<String>,
}

/// 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());

View on GitHub (pinned to 4685618388)

Solutions

  1. Validate the JSON and compare field names against EnrollmentData (room_id, baseline_id, fs_hz, anchors, session)
  2. Re-run enroll with the current build if the file came from an older schema
  3. Use --geometry for the geometry snapshot; --enrollment must be the enroll output
  4. Fix the syntax error at the exact line/column the {e} payload reports

Example fix

// before
{ "room": "living", "baseline_id": "…", "fs_hz": 100.0, "anchors": [], "session": {} }

// after
{ "room_id": "living", "baseline_id": "…", "fs_hz": 100.0, "anchors": [], "session": {} }
Defensive patterns

Strategy: validation

Validate before calling

fn enrollment_shape_ok(raw: &str) -> bool {
    let v: serde_json::Value = match serde_json::from_str(raw) {
        Ok(v) => v,
        Err(_) => return false,
    };
    for k in ["room_id", "baseline_id", "fs_hz", "anchors", "session"] {
        if v.get(k).is_none() {
            return false;
        }
    }
    v.get("anchors").map(|a| a.is_array()).unwrap_or(false)
}

Type guard

fn as_enrollment(raw: &str) -> Option<EnrollmentData> {
    serde_json::from_str(raw).ok()
}

Prevention

When it happens

Trigger: Hand-edited enrollment JSON with a typo or missing field; passing another JSON artifact (room-bank.json, a geometry file) as --enrollment; schema drift between the build that enrolled and the one training.

Common situations: Editing the file to rename a room or tweak fs_hz and breaking a field name; upgrading the CLI between enrollment and training; hand-authored files from other tooling.

Related errors


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