astral-sh/uv · error · anyhow::Error

pip-sync's `--ask` is unsupported (uv never asks for confirm

Error message

pip-sync's `--ask` is unsupported (uv never asks for confirmation)

What it means

pip-sync's `--ask` prompts for confirmation before it installs/uninstalls to make the environment match the requirements file. uv never asks for confirmation (its sync commands apply changes immediately), so `PipSyncCompatArgs::validate()` rejects the flag instead of silently not prompting — a silent no-op would be dangerous, since you would expect a safety gate that never fires.

Source

Thrown at crates/uv-cli/src/compat.rs:213

    #[clap(long, hide = true)]
    config: Option<String>,

    #[clap(long, hide = true)]
    no_config: bool,

    #[clap(long, hide = true)]
    pip_args: Option<String>,
}

impl CompatArgs for PipSyncCompatArgs {
    /// Validate the arguments passed for `pip-sync` compatibility.
    ///
    /// This method will warn when an argument is passed that has no effect but matches uv's
    /// behavior. If an argument is passed that does _not_ match uv's behavior, this method will
    /// return an error.
    fn validate(&self) -> Result<()> {
        if self.ask {
            return Err(anyhow!(
                "pip-sync's `--ask` is unsupported (uv never asks for confirmation)"
            ));
        }

        if self.python_executable.is_some() {
            return Err(anyhow!(
                "pip-sync's `--python-executable` is unsupported (to install into a separate Python environment, try setting `VIRTUAL_ENV` instead)"
            ));
        }

        if self.user {
            return Err(anyhow!(
                "pip-sync's `--user` is unsupported (use a virtual environment instead)"
            ));
        }

        if self.client_cert.is_some() {
            return Err(anyhow!(

View on GitHub (pinned to f1a42680ff)

Solutions

  1. Remove `--ask` and run `uv pip sync` only after reviewing the plan (or use `--dry-run` to preview changes).
  2. If you need a human gate, add your own confirmation step in the surrounding script before invoking uv.
  3. Consider `uv pip sync --dry-run` in CI to see what would change without applying it.

Example fix

# before
uv pip sync --ask requirements.txt

# after
uv pip sync --dry-run requirements.txt  # review
uv pip sync requirements.txt             # apply
Defensive patterns

Strategy: validation

Validate before calling

def check_sync_safety_flags(argv: list[str]) -> None:
    if "--ask" in argv:
        raise ValueError("uv pip sync never prompts; use --dry-run to preview changes")

Prevention

When it happens

Trigger: `uv pip sync --ask requirements.txt`, typically in a script or alias ported from pip-tools' pip-sync.

Common situations: Operators who used `pip-sync --ask` as a guardrail against destructive syncs; wrapper scripts that pass the same flags to both pip-sync and uv; Makefile targets that prompt in interactive use.

Related errors


AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16). Data as JSON: /api/errors/024de425d91a7835. Report an issue: GitHub.