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` supports a --repository-preview-directory option that only makes sense in combination with --repository-dry-run: a preview directory stages repository content without applying it, which presupposes the dry-run mode. If a preview directory is supplied without dry-run, mise rejects the combination up front rather than applying changes unexpectedly.

Solutions

  1. Add --repository-dry-run to the command.
  2. If you actually want to apply changes, remove --repository-preview-directory instead.
  3. Review `mise ssh --help` for the intended dry-run + preview workflow.

Example fix

// before
mise ssh --repository-preview-directory ./preview
// error: a repository preview directory requires a dry run

// after
mise ssh --repository-dry-run --repository-preview-directory ./preview
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "$preview_dir" ] && [ -z "$dry_run" ]; then echo 'add --repository-dry-run with --repository-preview-directory' >&2; fi

Try / catch

mise ssh --repository-dry-run --repository-preview-directory "$dir" || echo 'preview failed; inspect flags'

Prevention

When it happens

Trigger: Running `mise ssh --repository-preview-directory <dir>` without also passing --repository-dry-run.

Common situations: Testing repository setup changes with a preview directory but forgetting the dry-run flag; scripting the command and dropping the dry-run flag; misunderstanding the two flags as independent.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/c530f6a79fe5ecff. Report an issue: GitHub.

Appendix: 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 533346cc37)