{"record":{"id":"aaa03e5898b2e348","repo":"Zackriya-Solutions/meetily","slug":"failed-to-open-audio-file","errorCode":null,"errorMessage":"Failed to open audio file '{}': {}","messagePattern":"Failed to open audio file '(.+?)': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/decoder.rs","lineNumber":425,"sourceCode":"    // then auto-deletes it when dropped (even on error/panic).\n    let (_temp_wav_guard, decode_path): (Option<tempfile::TempPath>, Cow<'_, Path>) =\n        if needs_ffmpeg_conversion(path) {\n            info!(\n                \"Format requires ffmpeg pre-conversion: .{}\",\n                path.extension()\n                    .and_then(|e| e.to_str())\n                    .unwrap_or(\"unknown\")\n            );\n            let temp_path = convert_to_wav_with_ffmpeg(path, progress_callback.as_ref())?;\n            let wav_path = temp_path.to_path_buf();\n            (Some(temp_path), Cow::Owned(wav_path))\n        } else {\n            (None, Cow::Borrowed(path))\n        };\n\n    // Open the file (use decode_path which may be the temp WAV)\n    let file = std::fs::File::open(decode_path.as_ref())\n        .map_err(|e| anyhow!(\"Failed to open audio file '{}': {}\", decode_path.display(), e))?;\n\n    let mss = MediaSourceStream::new(Box::new(file), Default::default());\n\n    // Set up format hint based on file extension\n    let mut hint = Hint::new();\n    if let Some(ext) = decode_path.extension().and_then(|e| e.to_str()) {\n        hint.with_extension(ext);\n    }\n\n    // Probe the file format\n    let probed = symphonia::default::get_probe()\n        .format(\n            &hint,\n            mss,\n            &FormatOptions::default(),\n            &MetadataOptions::default(),\n        )\n        .map_err(|e| anyhow!(\"Failed to probe audio format: {}\", e))?;","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/decoder.rs#L407-L443","documentation":"std::fs::File::open failed on decode_path — the original file when no conversion ran, or the temp WAV when it did. The appended io::Error string distinguishes causes: NotFound (file moved/renamed/deleted between selection and decode), PermissionDenied (ACLs, protected directories, locks), or sharing violations on Windows when another process holds the file. Selection and decode can be minutes apart, so the path picked is not guaranteed to still open.","triggerScenarios":"File moved or deleted after being chosen in the picker; another app (media player, editor, cloud-sync client) holds a lock; importing directly from network/removable storage that unmounted or needs re-auth.","commonSituations":"Cloud-sync placeholders not yet downloaded, USB drives unplugged mid-flow, files renamed by other software between pick and import.","solutions":["Confirm the file still exists at the path shown in the message; it may have been moved or renamed after selection.","Close other programs holding locks on the file (players, editors, sync clients) and retry.","Copy the file from network/removable storage to local disk and import the copy.","Code fix: re-check existence right before open and give a re-pick prompt (see exampleFix)."],"exampleFix":"// before\nlet file = std::fs::File::open(decode_path.as_ref())\n    .map_err(|e| anyhow!(\"Failed to open audio file '{}': {}\", decode_path.display(), e))?;\n\n// after — distinguish 'gone' from 'locked'\nif !decode_path.as_ref().exists() {\n    return Err(anyhow!(\n        \"File not found: {} — it may have been moved or deleted after selection\",\n        decode_path.display()\n    ));\n}\nlet file = std::fs::File::open(decode_path.as_ref())\n    .map_err(|e| anyhow!(\n        \"Cannot open '{}' ({}): close other apps using the file and retry\",\n        decode_path.display(), e\n    ))?;","handlingStrategy":"validation","validationCode":"// Rust — re-check right before opening\nif !decode_path.as_ref().exists() {\n    return Err(anyhow!(\"File not found: {} — it may have been moved after selection\", decode_path.display()));\n}","typeGuard":null,"tryCatchPattern":"match std::fs::File::open(decode_path.as_ref()) {\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => { /* re-prompt the user to pick the file again */ },\n    Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => { /* ask to close other apps or copy the file locally */ },\n    other => other,\n}","preventionTips":["Copy imported files into app-managed storage immediately after selection.","Re-check existence right before decode — selection and decode can be minutes apart.","Avoid importing directly from network shares with auth timeouts."],"tags":["file-io","file-not-found","permissions","locking"],"backgroundTag":"file-open-permission-denied","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}