{"record":{"id":"5236efdc5a78f328","repo":"nikivdev/code","slug":"already-exists-use-force-to-overwrite-or-b","errorCode":null,"errorMessage":"{} already exists (use --force to overwrite or --bin to install under a different name)","messagePattern":"(.+?) already exists \\(use --force to overwrite or --bin to install under a different name\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/install.rs","lineNumber":195,"sourceCode":"    };\n\n    ensure_flox_tools_env(&install_root, &[(flox_pkg.to_string(), spec)])?;\n\n    let bin_name = opts.bin.clone().unwrap_or_else(|| name.to_string());\n    let bin_dir = opts.bin_dir.clone().unwrap_or_else(default_bin_dir);\n    fs::create_dir_all(&bin_dir)\n        .with_context(|| format!(\"failed to create {}\", bin_dir.display()))?;\n\n    let shim_path = bin_dir.join(&bin_name);\n    if shim_path.exists() && !opts.force {\n        if shim_matches(&shim_path, &install_root, &bin_name).unwrap_or(false) {\n            println!(\"{} already installed via flox.\", bin_name);\n            return Ok(());\n        }\n        if prompt_overwrite(&shim_path)? {\n            // continue and overwrite\n        } else {\n            bail!(\n                \"{} already exists (use --force to overwrite or --bin to install under a different name)\",\n                shim_path.display()\n            );\n        }\n    }\n\n    write_flox_shim(&shim_path, &install_root, &bin_name)?;\n\n    if flox_pkg != name {\n        println!(\n            \"Installed {} (flox package {}) via flox (shim at {})\",\n            name,\n            flox_pkg,\n            shim_path.display()\n        );\n    } else {\n        println!(\n            \"Installed {} via flox (shim at {})\",","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/install.rs#L177-L213","documentation":"Error \"{} already exists (use --force to overwrite or --bin to install under a different name)\" thrown in nikivdev/code.","triggerScenarios":"Thrown at src/install.rs:195 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}