{"record":{"id":"8907e75a32f8a7b4","repo":"jdx/mise","slug":"existing-file-conflicts-with-adoption-entry","errorCode":null,"errorMessage":"existing file conflicts with adoption: {entry}","messagePattern":"existing file conflicts with adoption: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":338,"sourceCode":"        return Ok(destination.to_path_buf());\n    }\n    let nonempty = destination.exists() && destination.read_dir()?.next().is_some();\n    if nonempty {\n        for entry in entries.split('\\0').filter(|s| !s.is_empty()) {\n            let mut ancestor = destination.to_path_buf();\n            for component in Path::new(entry).components() {\n                ancestor.push(component);\n                if ancestor.is_symlink() {\n                    bail!(\"existing symbolic link conflicts with adoption: {entry}\");\n                }\n            }\n            let existing = destination.join(entry);\n            if existing.exists()\n                && (checkout.join(entry).is_symlink()\n                    || !existing.is_file()\n                    || std::fs::read(&existing)? != std::fs::read(checkout.join(entry))?)\n            {\n                bail!(\"existing file conflicts with adoption: {entry}\");\n            }\n        }\n        if dry_run {\n            let new_files = entries\n                .split('\\0')\n                .filter(|s| !s.is_empty())\n                .filter(|entry| !destination.join(entry).exists())\n                .count();\n            miseprintln!(\n                \"Would adopt {shown} as the global configuration repository ({new_files} new file(s); existing files and local overrides preserved)\"\n            );\n            return Ok(destination.to_path_buf());\n        }\n        eprintln!(\n            \"Adopt existing global configuration at {} (preserving existing files and local overrides)\",\n            destination.display()\n        );\n        if !yes","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote_repository.rs#L320-L356","documentation":"During adoption of a non-empty destination, mise refuses to replace existing files. If a tracked entry already exists in the destination and either the source entry is itself a symlink, the existing path is not a regular file, or the file contents differ byte-for-byte from the checkout copy, adoption aborts. Existing files are never overwritten; only new files and Git metadata are moved.","triggerScenarios":"install/install_source/preview_source (install_at) into a non-empty directory without `.git`, where a file with the same tracked path exists in the destination but has different content, is a directory/fifo instead of a regular file, or the source copy is a symlink.","commonSituations":"User already has their own `settings.toml` with different content; a stale directory occupies a path the repo expects to be a file; the source repo symlinked a config file (which mise does not adopt).","solutions":["Compare and reconcile: `diff <destination>/<entry> <expected-content>`, then either update the destination file to match the repo or remove it so adoption can move the repo's copy in.","Back up your version and delete the destination file: `mv <entry> <entry>.bak`, then retry the install.","Commit your destination version into the source repository first (via the normal config workflow) so the contents match.","If the existing path is a directory where a file should be, remove or rename it, then retry."],"exampleFix":"// before\n$ diff ~/.config/mise/settings.toml repo-copy/settings.toml\ndiffer\n\n// after\n$ mv ~/.config/mise/settings.toml ~/.config/mise/settings.toml.bak\n// retry install; adopt repo copy, merge .bak changes back afterwards","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfor (const entry of trackedFiles) {\n  const p = dest + '/' + entry;\n  if (fs.existsSync(p) && !fs.statSync(p).isFile()) throw new Error('non-file blocks adoption: ' + p);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installSource(bundle, origin);\n} catch (e) {\n  if (/conflicts with adoption/.test(String(e.cause ?? e))) {\n    console.error('diff the listed file, back it up, and remove it so the repo copy can be moved in');\n  }\n  throw e;\n}","preventionTips":["Adopt an empty or dedicated directory, or reconcile your existing files with the repo before adopting","Keep destination-side customization inside *.local.toml files instead of editing tracked files","Diff your existing files against the repo contents before onboarding a machine"],"tags":["git","adoption","file-conflict","configuration"],"backgroundTag":"file-already-exists","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}