jdx/mise · error
a repository preview directory requires a dry run
Error message
a repository preview directory requires a dry run
What it means
`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.
Source
Thrown at src/cli/ssh.rs:71
#[usage(long, hide = true)]
repository_dry_run: bool,
#[usage(long, hide = true)]
repository_preview_directory: Option<PathBuf>,
#[usage(long, hide = true)]
global_config_directory: bool,
/// Command to execute after --; omit for an interactive shell
#[usage(trailing_var_arg = true, allow_hyphen_values = true)]
command: Vec<String>,
}
impl Ssh {
pub(crate) async fn run(self) -> Result<()> {
self.run_inner().await
}
async fn run_inner(self) -> Result<()> {
if self.repository_preview_directory.is_some() && !self.repository_dry_run {
bail!("a repository preview directory requires a dry run");
}
if self.global_config_directory {
println!(
"{}",
crate::system::remote_repository::global_directory().display()
);
return Ok(());
}
if let Some(bundle) = self.repository_bundle {
let origin = self
.repository_origin
.ok_or_else(|| eyre::eyre!("missing repository origin"))?;
let revision = self
.repository_revision
.ok_or_else(|| eyre::eyre!("missing repository revision"))?;
// a history-managed setup repository is set up from, never
// checked out into the configuration directory
if let Some(branch) =View on GitHub (pinned to afd2eddd3a)
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.
Example fix
// before mise ssh host --repository-preview-directory /tmp/preview // after mise ssh host --repository-dry-run --repository-preview-directory /tmp/preview
Defensive patterns
Strategy: validation
Validate before calling
if (args.includes('--repository-preview-directory') && !args.includes('--repository-dry-run')) {
throw new Error('--repository-preview-directory requires --repository-dry-run');
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- locked mode requires lockfile to be enabled hint: Remove `lo
- --changed does not accept target arguments
- --source can only be used with one target
- --operation takes at most one checkpoint reference
- cannot nest relay sessions
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/c530f6a79fe5ecff.
Report an issue: GitHub.