{"record":{"id":"c801294b0dbc16c9","repo":"Zackriya-Solutions/meetily","slug":"invalid-input-path-non-utf8","errorCode":null,"errorMessage":"Invalid input path (non-UTF8)","messagePattern":"Invalid input path \\(non-UTF8\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/decoder.rs","lineNumber":317,"sourceCode":"    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\n        .to_str()\n        .ok_or_else(|| anyhow!(\"Invalid input path (non-UTF8)\"))?;\n    let output_str = temp_path\n        .to_str()\n        .ok_or_else(|| anyhow!(\"Invalid temp path (non-UTF8)\"))?;\n\n    let mut command = Command::new(&ffmpeg_path);\n    command\n        .args([\n            \"-i\", input_str,\n            \"-vn\",                  // Strip video tracks\n            \"-acodec\", \"pcm_s16le\", // Output PCM WAV (Symphonia handles natively)\n            \"-y\",                   // Overwrite without prompt\n            output_str,\n        ])\n        .stdin(Stdio::null())\n        .stdout(Stdio::piped())\n        .stderr(Stdio::piped());\n\n    // Hide console window on Windows","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/decoder.rs#L299-L335","documentation":"Before spawning ffmpeg, both paths are converted with Path::to_str(), which returns None unless the entire path is valid UTF-8; this variant covers the input file path. Paths containing bytes that don't decode as UTF-8 (legacy-codepage filenames on Windows, undecodable byte sequences on Linux/macOS) cannot be passed as &str to Command arguments. Because the temp WAV is created in the same directory, a non-UTF-8 parent usually triggers the sibling 'Invalid temp path (non-UTF8)' error too.","triggerScenarios":"Importing a file whose name or parent directories contain non-UTF-8 bytes: files created by old Windows apps using ANSI codepages, downloads with mangled byte names on Linux, or files moved from filesystems that permit arbitrary bytes (ext4) into the app.","commonSituations":"Cross-platform file sharing with legacy encodings, archived files with odd names, or test assets saved with a non-Unicode codepage.","solutions":["Rename the file (and its non-ASCII parent folders) to UTF-8-safe characters and re-import.","On Windows, ensure the filename was created with a Unicode-capable encoding; avoid legacy codepage names.","Code fix: copy the input to an ASCII-named temp file and decode that when to_str() is None (see exampleFix)."],"exampleFix":"// before\nlet input_str = input_path.to_str()\n    .ok_or_else(|| anyhow!(\"Invalid input path (non-UTF8)\"))?;\n\n// after — copy to an ASCII-named temp file when the path is not UTF-8\nlet input_str = match input_path.to_str() {\n    Some(s) => s.to_string(),\n    None => {\n        let safe = std::env::temp_dir().join(format!(\n            \"meetily_import.{}\",\n            input_path.extension().and_then(|e| e.to_str()).unwrap_or(\"bin\")\n        ));\n        std::fs::copy(input_path, &safe)?;\n        safe.to_str().ok_or_else(|| anyhow!(\"temp_dir is not UTF-8\"))?.to_string()\n    }\n};","handlingStrategy":"validation","validationCode":"// Rust — reject early with a fixable message\nif input_path.to_str().is_none() {\n    return Err(anyhow!(\"File path contains non-UTF-8 characters — rename the file/folders and re-import.\"));\n}","typeGuard":null,"tryCatchPattern":"match decode_audio_file(&path, None) {\n    Err(e) if e.to_string().contains(\"non-UTF8\") => { /* prompt the user to rename the file */ }\n    other => other,\n}","preventionTips":["Sanitize imported filenames to UTF-8 at pick time.","Copy to an app-managed, ASCII-safe path immediately after file selection.","Keep Windows test assets with legacy-codepage names in CI to catch regressions."],"tags":["path-encoding","utf8","ffmpeg","import"],"backgroundTag":"non-utf8-file-path","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}