tonhowtf/omniget · error

nao foi possivel mover a instalacao para o lugar

Error message

nao foi possivel mover a instalacao para o lugar: {}

What it means

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).

Solutions

  1. Read the wrapped io::Error: EXDEV means use copy+delete instead of rename across filesystems
  2. Ensure no process (Spotify, antivirus, indexer) is locking the target directory during install
  3. Check write permissions on the data directory's parent
  4. Re-run install; the code already restores the old installation on failure

Example fix

// before
if let Err(e) = std::fs::rename(&staging, &dir) {
// after
if let Err(e) = std::fs::rename(&staging, &dir).or_else(|_| fs_extra::dir::move_dir(&staging, &dir, &CopyOptions::new())) {
Defensive patterns

Strategy: fallback

Validate before calling

let same_fs = staging.parent() == dir.parent(); // stage beside target to keep rename atomic
if !writable(dir.parent().unwrap()) { return Err(anyhow!("parent dir not writable")); }

Try / catch

match install().await {
    Err(e) if e.to_string().contains("mover a instalacao") => {
        // old install was restored; advise closing Spotify/antivirus and retrying
        advise_close_spotify_and_retry(e);
    }
    other => handle(other),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/713d015434627177. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/spicetify.rs:555

    let exe = staging.join(bin_name("spicetify"));
    if !exe.exists() {
        let _ = std::fs::remove_dir_all(&staging);
        return Err(anyhow!(
            "o arquivo baixado nao contem o executavel do spicetify"
        ));
    }
    make_executable(&exe);

    let old = dir.with_extension("old");
    let _ = std::fs::remove_dir_all(&old);
    if dir.exists() {
        std::fs::rename(&dir, &old)?;
    }
    if let Err(e) = std::fs::rename(&staging, &dir) {
        if old.exists() {
            let _ = std::fs::rename(&old, &dir);
        }
        return Err(anyhow!(
            "nao foi possivel mover a instalacao para o lugar: {}",
            e
        ));
    }
    let _ = std::fs::remove_dir_all(&old);

    let final_exe = dir.join(bin_name("spicetify"));
    #[cfg(target_os = "macos")]
    {
        let quarantine_target = dir.clone();
        let _ = tokio::task::spawn_blocking(move || {
            crate::core::process::std_command("xattr")
                .args(["-dr", "com.apple.quarantine"])
                .arg(&quarantine_target)
                .output()
        })
        .await;
    }

View on GitHub (pinned to 8600b91f42)