{"record":{"id":"713d015434627177","repo":"tonhowtf/omniget","slug":"nao-foi-possivel-mover-a-instalacao-para-o-lugar","errorCode":null,"errorMessage":"nao foi possivel mover a instalacao para o lugar: {}","messagePattern":"nao foi possivel mover a instalacao para o lugar: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/spicetify.rs","lineNumber":555,"sourceCode":"    let exe = staging.join(bin_name(\"spicetify\"));\n    if !exe.exists() {\n        let _ = std::fs::remove_dir_all(&staging);\n        return Err(anyhow!(\n            \"o arquivo baixado nao contem o executavel do spicetify\"\n        ));\n    }\n    make_executable(&exe);\n\n    let old = dir.with_extension(\"old\");\n    let _ = std::fs::remove_dir_all(&old);\n    if dir.exists() {\n        std::fs::rename(&dir, &old)?;\n    }\n    if let Err(e) = std::fs::rename(&staging, &dir) {\n        if old.exists() {\n            let _ = std::fs::rename(&old, &dir);\n        }\n        return Err(anyhow!(\n            \"nao foi possivel mover a instalacao para o lugar: {}\",\n            e\n        ));\n    }\n    let _ = std::fs::remove_dir_all(&old);\n\n    let final_exe = dir.join(bin_name(\"spicetify\"));\n    #[cfg(target_os = \"macos\")]\n    {\n        let quarantine_target = dir.clone();\n        let _ = tokio::task::spawn_blocking(move || {\n            crate::core::process::std_command(\"xattr\")\n                .args([\"-dr\", \"com.apple.quarantine\"])\n                .arg(&quarantine_target)\n                .output()\n        })\n        .await;\n    }","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/spicetify.rs#L537-L573","documentation":"install stages the new CLI beside the current dir, renames dir -> old, then renames staging -> dir; if the second rename fails it rolls back and returns this error wrapping the underlying io::Error. This typically means the swap could not be performed on the filesystem (cross-device link, permissions, or file held open).","triggerScenarios":"Calling install when the staging dir and final dir end up on different filesystems (EXDEV), the target dir is locked by a running process, or the user lacks write permission on the parent directory.","commonSituations":"Data dir on NFS/network mount while staging is local; Spotify/antivirus holding files open in the old dir on Windows; read-only parent dir after a system update.","solutions":["Read the wrapped io::Error: EXDEV means use copy+delete instead of rename across filesystems","Ensure no process (Spotify, antivirus, indexer) is locking the target directory during install","Check write permissions on the data directory's parent","Re-run install; the code already restores the old installation on failure"],"exampleFix":"// before\nif let Err(e) = std::fs::rename(&staging, &dir) {\n// after\nif let Err(e) = std::fs::rename(&staging, &dir).or_else(|_| fs_extra::dir::move_dir(&staging, &dir, &CopyOptions::new())) {","handlingStrategy":"fallback","validationCode":"let same_fs = staging.parent() == dir.parent(); // stage beside target to keep rename atomic\nif !writable(dir.parent().unwrap()) { return Err(anyhow!(\"parent dir not writable\")); }","typeGuard":null,"tryCatchPattern":"match install().await {\n    Err(e) if e.to_string().contains(\"mover a instalacao\") => {\n        // old install was restored; advise closing Spotify/antivirus and retrying\n        advise_close_spotify_and_retry(e);\n    }\n    other => handle(other),\n}","preventionTips":["Always stage the new install on the same filesystem as the target","Close Spotify and pause antivirus/indexers during install","Check write permissions on the data dir parent before starting"],"tags":["filesystem","install","io"],"backgroundTag":"file-write-failed","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"}