{"record":{"id":"7388830984354107","repo":"tonhowtf/omniget","slug":"pasta-de-origem-n-o-encontrada","errorCode":null,"errorMessage":"pasta de origem não encontrada: {}","messagePattern":"pasta de origem não encontrada: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/games/switch_album.rs","lineNumber":259,"sourceCode":"            \"-c:a\",\n            \"libopus\",\n            \"-b:a\",\n            \"96k\",\n        ])\n        .arg(&output)\n        .output()\n        .await\n        .map_err(|e| anyhow::anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n    if !out.status.success() {\n        anyhow::bail!(\"{}\", String::from_utf8_lossy(&out.stderr).trim());\n    }\n    Ok(output)\n}\n\npub async fn run(opts: SwitchOptions, progress: ProgressFn) -> anyhow::Result<SwitchResult> {\n    let source = PathBuf::from(opts.source.trim());\n    if !source.is_dir() {\n        anyhow::bail!(\"pasta de origem não encontrada: {}\", source.display());\n    }\n    let dest_root = PathBuf::from(opts.dest.trim());\n    if opts.dest.trim().is_empty() {\n        anyhow::bail!(\"escolha a pasta da biblioteca de destino\");\n    }\n    let move_it = opts.mode == \"move\";\n\n    report(&progress, ID, \"progress\", 0, None, None);\n    let found = collect(&source, &opts.kinds);\n    let total = found.len() as u64;\n    if total == 0 {\n        report(&progress, ID, \"done\", 0, Some(0), None);\n        return Ok(SwitchResult {\n            items: Vec::new(),\n            games: Vec::new(),\n            found: 0,\n            imported: 0,\n            skipped: 0,","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/games/switch_album.rs#L241-L277","documentation":"Thrown by SwitchAlbum's `run` when the configured source path (`opts.source`) does not exist as a directory on disk. The tool refuses to start scanning a non-existent source folder instead of silently returning zero files, so the user gets an explicit Portuguese message including the path checked.","triggerScenarios":"Calling `run(SwitchOptions { source: <path>, .. })` where `PathBuf::from(opts.source.trim()).is_dir()` is false — the path doesn't exist, is a file instead of a directory, or the string is empty/whitespace.","commonSituations":"User typo'd the SD card mount path; the SD card (e.g. /run/media/user/CARD) was unplugged before the transfer; path points to a single screenshot file rather than the album root; forward/back slash confusion when passing Windows paths into the Tauri backend.","solutions":["Check the exact path printed in the message with `ls` (or Explorer) and fix the typo in the source field","Point `source` at the album directory (e.g. the SD card's Nintendo/Album root), not a file","Re-insert/mount the SD card or drive and retry","Verify the frontend actually passes a non-empty `source` string to the command"],"exampleFix":"// before\nrun(SwitchOptions { source: \"/run/media/user/CARD/Nintendo/Album \", .. })\n// after\nrun(SwitchOptions { source: \"/run/media/user/CARD/Nintendo/Album\", .. })  // trimmed, exists, is a dir","handlingStrategy":"validation","validationCode":"if !std::path::Path::new(source.trim()).is_dir() {\n    return Err(format!(\"source folder does not exist or is not a directory: {}\", source));\n}","typeGuard":"fn is_valid_source_dir(p: &str) -> bool {\n    std::path::Path::new(p.trim()).is_dir()\n}","tryCatchPattern":"match switch_album::run(opts, progress).await {\n    Ok(result) => handle(result),\n    Err(e) if e.to_string().contains(\"pasta de origem\") => prompt_user_for_valid_source(),\n    Err(e) => return Err(e),\n}","preventionTips":["Validate the source path exists and is a directory in the UI before invoking the command","Use a folder picker rather than free-text input","Re-check removable media is mounted before starting a transfer"],"tags":["filesystem","validation","rust","tauri"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}