{"record":{"id":"c530f6a79fe5ecff","repo":"jdx/mise","slug":"a-repository-preview-directory-requires-a-dry-run","errorCode":null,"errorMessage":"a repository preview directory requires a dry run","messagePattern":"a repository preview directory requires a dry run","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/ssh.rs","lineNumber":71,"sourceCode":"    #[usage(long, hide = true)]\n    repository_dry_run: bool,\n    #[usage(long, hide = true)]\n    repository_preview_directory: Option<PathBuf>,\n    #[usage(long, hide = true)]\n    global_config_directory: bool,\n    /// Command to execute after --; omit for an interactive shell\n    #[usage(trailing_var_arg = true, allow_hyphen_values = true)]\n    command: Vec<String>,\n}\n\nimpl Ssh {\n    pub(crate) async fn run(self) -> Result<()> {\n        self.run_inner().await\n    }\n\n    async fn run_inner(self) -> Result<()> {\n        if self.repository_preview_directory.is_some() && !self.repository_dry_run {\n            bail!(\"a repository preview directory requires a dry run\");\n        }\n        if self.global_config_directory {\n            println!(\n                \"{}\",\n                crate::system::remote_repository::global_directory().display()\n            );\n            return Ok(());\n        }\n        if let Some(bundle) = self.repository_bundle {\n            let origin = self\n                .repository_origin\n                .ok_or_else(|| eyre::eyre!(\"missing repository origin\"))?;\n            let revision = self\n                .repository_revision\n                .ok_or_else(|| eyre::eyre!(\"missing repository revision\"))?;\n            // a history-managed setup repository is set up from, never\n            // checked out into the configuration directory\n            if let Some(branch) =","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/ssh.rs#L53-L89","documentation":"`mise ssh` (src/cli/ssh.rs:71) rejects a combination of flags: `--repository-preview-directory` was provided without `--repository-dry-run`. A preview directory stages repository setup output for inspection, which is only meaningful (and only safe) in dry-run mode, so run_inner bails when one is set without the other.","triggerScenarios":"Invoking `mise ssh --repository-preview-directory <dir> ...` while omitting the `--repository-dry-run` flag; conditionally constructed CLI args that set the preview dir but leave dry_run false.","commonSituations":"Wiring up dotfiles-repository previewing in a script and forgetting the paired flag; copying a dry-run command and stripping the dry-run flag while keeping the preview path; typos in wrapper scripts building the argument list.","solutions":["Add `--repository-dry-run` to the same command.","Remove `--repository-preview-directory` if you actually want to apply (not preview) the repository setup.","Update wrapper scripts/aliases so the two flags are always emitted together."],"exampleFix":"// before\nmise ssh host --repository-preview-directory /tmp/preview\n\n// after\nmise ssh host --repository-dry-run --repository-preview-directory /tmp/preview","handlingStrategy":"validation","validationCode":"if (args.includes('--repository-preview-directory') && !args.includes('--repository-dry-run')) {\n  throw new Error('--repository-preview-directory requires --repository-dry-run');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build preview commands from a helper that always emits both flags together.","Preview the command with --dry-run before running it for real.","Never strip the dry-run flag from working command templates."],"tags":["cli","ssh","flags","dry-run"],"backgroundTag":"mutually-dependent-flags","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"}