{"record":{"id":"fc2c297727aa201c","repo":"Zackriya-Solutions/meetily","slug":"failed-to-create-temporary-wav-file","errorCode":null,"errorMessage":"Failed to create temporary WAV file: {}","messagePattern":"Failed to create temporary WAV file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/decoder.rs","lineNumber":297,"sourceCode":") -> Result<tempfile::TempPath> {\n    let ffmpeg_path = find_ffmpeg_path().ok_or_else(|| {\n        anyhow!(\n            \"FFmpeg not found. FFmpeg is required to decode .{} files. \\\n             It will be downloaded automatically on next launch, or install it manually.\",\n            input_path\n                .extension()\n                .and_then(|e| e.to_str())\n                .unwrap_or(\"this format\")\n        )\n    })?;\n\n    // Create temp file in the same directory as the input to avoid cross-device issues\n    let parent_dir = input_path.parent().unwrap_or_else(|| Path::new(\".\"));\n    let temp_file = tempfile::Builder::new()\n        .prefix(\".meetily_decode_\")\n        .suffix(\".wav\")\n        .tempfile_in(parent_dir)\n        .map_err(|e| anyhow!(\"Failed to create temporary WAV file: {}\", e))?;\n\n    let temp_path = temp_file.into_temp_path();\n\n    info!(\n        \"Converting .{} to temporary WAV via ffmpeg: {} -> {}\",\n        input_path\n            .extension()\n            .and_then(|e| e.to_str())\n            .unwrap_or(\"unknown\"),\n        input_path.display(),\n        temp_path.display()\n    );\n\n    if let Some(cb) = progress_callback {\n        cb(0, \"Converting audio format with FFmpeg...\");\n    }\n\n    let input_str = input_path","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/decoder.rs#L279-L315","documentation":"The FFmpeg conversion deliberately creates its temp WAV in the input file's directory (tempfile_in(parent_dir)) to avoid cross-device rename/link issues — so it needs write permission in the source folder. This io::Error means tempfile could not create .meetily_decode_*.wav there: a read-only directory (mounted media, Windows protected folders, read-only network share), a full disk, or the directory disappearing between file selection and import.","triggerScenarios":"Importing audio from an SD card or read-only mount; Windows 'Controlled Folder Access' blocking writes next to the input; importing from a read-only SMB share; disk full at conversion time; parent directory deleted after the picker closed.","commonSituations":"Users dragging files straight from cameras, phones in MTP mode, DVD rips, or cloud-sync folders marked read-only; low-disk machines during long imports.","solutions":["Copy the file to a writable location (Desktop/Documents) and import the copy.","On Windows, remove the folder from Controlled Folder Access / protected folders, or grant the app write access there.","Free disk space on the volume holding the input file.","Code fix: fall back to std::env::temp_dir() when tempfile_in(parent_dir) fails with PermissionDenied (see exampleFix)."],"exampleFix":"// before\nlet temp_file = tempfile::Builder::new()\n    .prefix(\".meetily_decode_\")\n    .suffix(\".wav\")\n    .tempfile_in(parent_dir)\n    .map_err(|e| anyhow!(\"Failed to create temporary WAV file: {}\", e))?;\n\n// after — fall back to the system temp dir when the input dir is read-only\nlet temp_file = match tempfile::Builder::new()\n    .prefix(\".meetily_decode_\")\n    .suffix(\".wav\")\n    .tempfile_in(parent_dir)\n{\n    Ok(f) => f,\n    Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => {\n        tempfile::Builder::new()\n            .prefix(\".meetily_decode_\")\n            .suffix(\".wav\")\n            .tempfile_in(std::env::temp_dir())?\n    }\n    Err(e) => return Err(anyhow!(\"Failed to create temporary WAV file: {}\", e)),\n};","handlingStrategy":"fallback","validationCode":"// Rust — copy read-only sources to a writable temp dir before decoding\nlet work_path = if dir_is_writable(parent_dir) { path.to_path_buf() } else { copy_to_temp(path)? };","typeGuard":null,"tryCatchPattern":"match convert_to_wav_with_ffmpeg(&path, None) {\n    Err(e) if e.to_string().contains(\"temporary WAV\") => {\n        // retry with the input copied into a writable directory\n    }\n    other => other,\n}","preventionTips":["Copy files from read-only media (SD cards, protected shares) into app storage before decoding.","Keep std::env::temp_dir() as a fallback location for tempfile creation.","Check free disk space before starting a large import."],"tags":["ffmpeg","tempfile","permissions","disk-full"],"backgroundTag":"temp-file-creation-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}