{"record":{"id":"c9de4e73e8733eb6","repo":"jdx/mise","slug":"adoption-requires-confirmation-review-the-directo","errorCode":null,"errorMessage":"adoption requires confirmation; review the directory and retry with --yes","messagePattern":"adoption requires confirmation; review the directory and retry with --yes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":360,"sourceCode":"            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\n            && !crate::ui::confirm(\"Adopt this directory as the global configuration repository?\")?\n                .is_yes()\n        {\n            bail!(\"adoption requires confirmation; review the directory and retry with --yes\");\n        }\n        // Existing files are never replaced. Move only new files and Git metadata;\n        // an interrupted adoption remains recoverable without deleting user data.\n        for entry in entries.split('\\0').filter(|s| !s.is_empty()) {\n            let target = destination.join(entry);\n            if !target.exists() {\n                if let Some(parent) = target.parent() {\n                    std::fs::create_dir_all(parent)?;\n                }\n                std::fs::rename(checkout.join(entry), target)?;\n            }\n        }\n        std::fs::rename(checkout.join(\".git\"), destination.join(\".git\"))?;\n    } else if dry_run {\n        miseprintln!(\"Would clone {origin} at {revision} into {shown}\");\n    } else {\n        if destination.exists() {\n            std::fs::remove_dir(destination)?;","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote_repository.rs#L342-L378","documentation":"Adopting an existing non-empty directory as the global-configuration repository is a destructive-ish operation, so mise requires explicit confirmation. It prompts interactively; if the user declines or the command runs non-interactively without the `--yes` flag, the adoption aborts before any files or Git metadata are moved.","triggerScenarios":"install/install_source/preview_source (install_at) targeting a non-empty destination without `.git`, run either (a) non-interactively without `--yes`, or (b) interactively where the user answered no to the confirmation prompt.","commonSituations":"Scripted/CI onboarding runs where no TTY exists and `--yes` was omitted; users piped the command and never saw the prompt; users reviewed the listed directory contents and deliberately declined.","solutions":["Re-run the command with `--yes` to skip the interactive confirmation.","First review the directory contents and the listed new/conflicting files, then confirm with `--yes` once satisfied.","For automation, add `--yes` to the script after a one-time manual review.","If you declined intentionally, adopt a different (empty or dedicated) destination directory instead."],"exampleFix":"// before (non-interactive, fails)\n$ mise config install-source <bundle> --origin <url>\nadoption requires confirmation\n\n// after\n$ mise config install-source <bundle> --origin <url> --yes","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await installSource(bundle, origin);\n} catch (e) {\n  if (/requires confirmation/.test(String(e.cause ?? e))) {\n    // non-interactive context: re-run with explicit consent after review\n    return installSource(bundle, origin, { yes: true });\n  }\n  throw e;\n}","preventionTips":["Pass --yes when running non-interactively (CI, scripts) after a one-time manual review","Review the destination directory contents before first-time adoption","Adopt a dedicated, curated directory rather than an arbitrary populated one"],"tags":["git","confirmation","cli","adoption"],"backgroundTag":"missing-required-flag","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"}