{"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":"validation","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/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/remote_repository.rs#L342-L378","documentation":"Adopting an existing non-empty directory as the global configuration repository is a destructive-looking operation, so install_at asks for interactive confirmation. When the prompt is declined (or cannot be answered because input is not a TTY / `--yes` was not passed), the tool aborts with this error rather than proceeding without explicit consent.","triggerScenarios":"Running install/preview_source against an existing non-empty destination without `.git`, in non-interactive contexts (CI, scripts, piped stdin) or with the confirmation prompt answered 'no' — whenever `yes` is false and `crate::ui::confirm` does not return yes.","commonSituations":"Automation/CI scripts run the installer without a TTY; user reviews the adoption summary and declines; a wrapper suppresses stdin so the prompt defaults to no.","solutions":["Inspect the destination directory first, then re-run with `--yes` to confirm adoption non-interactively.","Answer the interactive prompt with 'y' when running in a terminal.","For automation, pre-approve by passing `--yes` explicitly in the script/CI step.","If adoption is not wanted, point the install at an empty/fresh directory instead."],"exampleFix":"// before: CI script fails at the confirmation prompt\nmise config install-source ./config.bundle\n// after\nmise config install-source --yes ./config.bundle","handlingStrategy":"try-catch","validationCode":"if (!process.stdout.isTTY && !args.includes('--yes')) {\n  throw new Error('non-interactive shell: pass --yes to confirm adoption');\n}","typeGuard":null,"tryCatchPattern":"try {\n  runInstall(dest, { yes: false });\n} catch (e) {\n  if (String(e).includes('adoption requires confirmation')) {\n    runInstall(dest, { yes: true }); // after reviewing the directory\n  } else throw e;\n}","preventionTips":["Pass `--yes` explicitly in scripts, CI, and non-TTY contexts.","Review the destination directory contents before the first adoption run.","Preview with a dry run to see the adoption summary before confirming."],"tags":["git","confirmation","non-interactive"],"backgroundTag":"authentication-required","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}