{"record":{"id":"329e109121a95172","repo":"ruvnet/RuView","slug":"cannot-read-e-run-enroll-first","errorCode":null,"errorMessage":"cannot read {}: {e} — run `enroll` first","messagePattern":"cannot read (.+?): (.+?) — run `enroll` first","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v2/crates/wifi-densepose-cli/src/room.rs","lineNumber":243,"sourceCode":"    pub enrollment: String,\n    /// Output specialist-bank file.\n    #[arg(long, default_value = \"./room-bank.json\")]\n    pub output: String,\n    /// Optional transceiver-geometry file: a JSON array of `NodeGeometry`\n    /// records (ADR-152 §2.1.1). Recorded into the enrollment session before\n    /// training so the bank carries the layout it was trained under.\n    #[arg(long)]\n    pub geometry: Option<String>,\n}\n\n/// Execute `train-room`.\n///\n/// If the enrollment session carries a transceiver-geometry snapshot (recorded\n/// at enroll time or supplied here via `--geometry`), it is threaded into the\n/// bank (ADR-152 §2.1.1); a geometry-free enrollment still trains a valid bank.\npub async fn train_room(args: TrainRoomArgs) -> Result<()> {\n    let raw = std::fs::read_to_string(&args.enrollment)\n        .map_err(|e| anyhow::anyhow!(\"cannot read {}: {e} — run `enroll` first\", args.enrollment))?;\n    let mut data: EnrollmentData =\n        serde_json::from_str(&raw).map_err(|e| anyhow::anyhow!(\"invalid enrollment: {e}\"))?;\n    if data.anchors.is_empty() {\n        bail!(\"no accepted anchors in {} — re-run enroll\", args.enrollment);\n    }\n\n    if let Some(path) = &args.geometry {\n        let graw = std::fs::read_to_string(path)\n            .map_err(|e| anyhow::anyhow!(\"cannot read geometry {path}: {e}\"))?;\n        let geometry: Vec<NodeGeometry> = serde_json::from_str(&graw).map_err(|e| {\n            anyhow::anyhow!(\"invalid geometry {path}: {e} (expected a JSON array of NodeGeometry records)\")\n        })?;\n        data.session.record_geometry(geometry, now_unix());\n    }\n\n    let mut bank = SpecialistBank::train(&data.room_id, &data.baseline_id, &data.anchors, now_unix())\n        .map_err(|e| anyhow::anyhow!(\"training failed: {e}\"))?;\n    match data.session.geometry() {","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/wifi-densepose-cli/src/room.rs#L225-L261","documentation":"train-room failed to std::fs::read_to_string the --enrollment JSON file; the message directs to 'run enroll first'. Typical io::Error kinds: NotFound (no enroll run yet or wrong path), permission denied, or InvalidData when the file is not valid UTF-8 — e.g. a binary baseline passed by mistake.","triggerScenarios":"Running train-room before enroll produced the file; --enrollment pointing at the binary baseline instead of enrollment JSON; non-UTF-8 content; unreadable permissions.","commonSituations":"Workflow ordering mistakes across the calibrate, enroll, train-room chain; artifact-type mixups; relative paths breaking across working directories.","solutions":["Run enroll and use the path it prints","Pass the enrollment .json file, not the binary baseline","Prefer absolute paths or a fixed working directory","Fix read permissions if the file exists"],"exampleFix":"// before\n$ ruview train-room --enrollment ./baseline.bin   # cannot read — run `enroll` first\n\n// after\n$ ruview enroll --output ./artifacts/enrollment.json\n$ ruview train-room --enrollment ./artifacts/enrollment.json","handlingStrategy":"validation","validationCode":"fn enrollment_readable(path: &str) -> bool {\n    std::path::Path::new(path).is_file() && std::fs::read_to_string(path).is_ok()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Chain the commands in one script so the path each stage prints feeds the next step","Name artifacts distinctly (enrollment .json vs binary baseline) to avoid mixups","Check the file is UTF-8 text if it was produced outside the CLI"],"tags":["rust","filesystem","enrollment","cli"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}