{"record":{"id":"786be58f463bf6f4","repo":"ruvnet/RuView","slug":"cannot-create-output-dir-e","errorCode":null,"errorMessage":"cannot create output dir {}: {e}","messagePattern":"cannot create output dir (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v2/crates/wifi-densepose-cli/src/calibrate_api.rs","lineNumber":315,"sourceCode":"        .route(\"/api/v1/calibration/health\", get(health))\n        .route(\"/api/v1/calibration/start\", post(start))\n        .route(\"/api/v1/calibration/status\", get(status_handler))\n        .route(\"/api/v1/calibration/stop\", post(stop))\n        .route(\"/api/v1/calibration/result\", get(result))\n        .route(\"/api/v1/calibration/baselines\", get(baselines))\n        .route(\"/api/v1/room/state\", get(room_state))\n        .route(\"/api/v1/room/train\", post(train_room))\n        .route(\"/api/v1/enroll/anchor\", post(enroll_anchor))\n        .route(\"/api/v1/enroll/geometry\", post(enroll_geometry))\n        .route(\"/api/v1/enroll/status\", get(enroll_status))\n        .layer(CorsLayer::permissive())\n        .with_state(state)\n}\n\n/// Run the calibration HTTP API server (blocks until Ctrl-C).\npub async fn execute(args: CalibrateServeArgs) -> Result<()> {\n    std::fs::create_dir_all(&args.output_dir)\n        .map_err(|e| anyhow::anyhow!(\"cannot create output dir {}: {e}\", args.output_dir))?;\n\n    let udp_addr = format!(\"{}:{}\", args.udp_bind, args.udp_port);\n    let socket = UdpSocket::bind(&udp_addr)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"cannot bind UDP socket on {udp_addr}: {e}\"))?;\n    eprintln!(\"[calibrate-serve] CSI ingest on udp://{udp_addr}\");\n\n    let status = Arc::new(RwLock::new(SharedStatus {\n        udp_port: args.udp_port,\n        default_tier: args.tier.clone(),\n        output_dir: args.output_dir.clone(),\n        ..Default::default()\n    }));\n\n    let (cmd_tx, cmd_rx) = mpsc::channel::<CalCommand>(8);\n    let window = Arc::new(RwLock::new(VecDeque::<f32>::with_capacity(LIVE_WINDOW)));\n    let enroll = Arc::new(RwLock::new(HashMap::<String, RoomEnroll>::new()));\n","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/wifi-densepose-cli/src/calibrate_api.rs#L297-L333","documentation":"std::fs::create_dir_all failed for the calibrate-serve --output-dir at HTTP API startup. It is an OS-level io::Error: permission denied on a path component, a component that already exists as a regular file, an invalid path string, or an I/O error on the volume. The server aborts before binding any socket.","triggerScenarios":"Starting calibrate-serve with --output-dir whose parent is not writable; --output-dir naming an existing regular file; a read-only mount (container rootfs); a path containing an invalid component.","commonSituations":"Container images where the data volume is not mounted at the configured path; CI or services running as non-root against root-owned paths; a previous run leaving a file where the directory is expected.","solutions":["Manually run mkdir -p as the same user the server runs as to surface the exact OS error","Remove or rename the regular file occupying the path","Point --output-dir to a writable volume or mount one at that path","Fix ownership/permissions on the parent directory (chown/chmod)"],"exampleFix":"// before\n$ ruview calibrate-serve --output-dir /var/lib/ruview/baselines   # create_dir_all fails\n\n// after\n$ mkdir -p /var/lib/ruview/baselines && chown $(id -u) /var/lib/ruview/baselines\n$ ruview calibrate-serve --output-dir /var/lib/ruview/baselines","handlingStrategy":"validation","validationCode":"fn ensure_output_dir(path: &str) -> Result<(), String> {\n    let p = std::path::Path::new(path);\n    if p.exists() && !p.is_dir() {\n        return Err(format!(\"{path} exists and is not a directory\"));\n    }\n    std::fs::create_dir_all(p).map_err(|e| format!(\"cannot create {path}: {e}\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create the output dir in deployment units (systemd ExecStartPre, container entrypoint) before the server starts","Mount a writable volume at the configured output path in containers","Avoid root-owned --output-dir paths when the service runs unprivileged"],"tags":["rust","filesystem","http-api","calibration","startup"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}