{"record":{"id":"7f059039b3f6bcdc","repo":"ruvnet/RuView","slug":"cannot-write-e","errorCode":null,"errorMessage":"cannot write {}: {e}","messagePattern":"cannot write (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v2/crates/wifi-densepose-cli/src/room.rs","lineNumber":208,"sourceCode":"        }\n    }\n\n    if session.is_complete() {\n        session.apply(EnrollmentEvent::Completed { at: now_unix() });\n    }\n    let (got, total) = session.progress();\n    let data = EnrollmentData {\n        room_id: args.room_id.clone(),\n        baseline_id,\n        fs_hz: args.fs_hz,\n        anchors: features,\n        session,\n    };\n    std::fs::write(\n        &args.output,\n        serde_json::to_string_pretty(&data).map_err(|e| anyhow::anyhow!(\"serialize: {e}\"))?,\n    )\n    .map_err(|e| anyhow::anyhow!(\"cannot write {}: {e}\", args.output))?;\n    eprintln!(\n        \"\\n[enroll] done: {got}/{total} anchors accepted → {} (next: `train-room`)\",\n        args.output\n    );\n    Ok(())\n}\n\n// ---------------------------------------------------------------------------\n// train-room\n// ---------------------------------------------------------------------------\n\n/// Arguments for `train-room`.\n#[derive(Args, Debug, Clone)]\npub struct TrainRoomArgs {\n    /// Enrollment file from `enroll`.\n    #[arg(long, default_value = \"./enrollment.json\")]\n    pub enrollment: String,\n    /// Output specialist-bank file.","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/wifi-densepose-cli/src/room.rs#L190-L226","documentation":"std::fs::write failed to persist the pretty-printed enrollment JSON to --output at the end of a completed enroll session. OS-level io::Error: missing parent directory, permissions, disk full, or the path naming a directory. The interactive anchor captures succeeded but the features exist only in memory, so a write failure means re-enrolling.","triggerScenarios":"--output pointing into a nonexistent directory; unwritable or foreign-owned target; disk full; --output naming an existing directory.","commonSituations":"Fresh directories never created; running as a different user; full disks in constrained environments — especially costly here because the whole interactive session must be repeated.","solutions":["Create the parent directory before starting enroll (mkdir -p)","Fix permissions/ownership on the output directory","Free disk space or choose another --output path","Confirm the path is a file location, then re-run the enrollment"],"exampleFix":"// before\nstd::fs::write(\n    &args.output,\n    serde_json::to_string_pretty(&data).map_err(|e| anyhow::anyhow!(\"serialize: {e}\"))?,\n)\n.map_err(|e| anyhow::anyhow!(\"cannot write {}: {e}\", args.output))?;\n\n// after\nif let Some(parent) = std::path::Path::new(&args.output).parent() {\n    std::fs::create_dir_all(parent)\n        .map_err(|e| anyhow::anyhow!(\"cannot create {}: {e}\", parent.display()))?;\n}\nstd::fs::write(\n    &args.output,\n    serde_json::to_string_pretty(&data).map_err(|e| anyhow::anyhow!(\"serialize: {e}\"))?,\n)\n.map_err(|e| anyhow::anyhow!(\"cannot write {}: {e}\", args.output))?;","handlingStrategy":"validation","validationCode":"fn enrollment_output_ok(path: &str) -> bool {\n    let p = std::path::Path::new(path);\n    p.parent().map(|d| d.is_dir()).unwrap_or(true)\n        && !p.is_dir()\n        && std::fs::OpenOptions::new().write(true).create(true).truncate(false).open(p).is_ok()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate --output writability BEFORE starting the interactive anchor prompts — a failure after capture wastes the whole session","Script enroll runs with pre-created output directories","Keep disk headroom on the volume holding enrollment artifacts"],"tags":["rust","filesystem","io","enrollment"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}