Morganamilo/paru · error · anyhow::Error
only one operation may be used at a time
Error message
only one operation may be used at a time
What it means
While parsing the command line, paru counts mutually exclusive operations via parse_arg/op_count. If more than one operation flag is supplied (e.g. -S and -Q together), the ensure! fires with this pacman-compatible error.
Solutions
- Split into separate invocations, one operation per command: `paru -Syu` then `paru -Qu`.
- Inspect combined short flags for accidental extra operation letters (e.g. -Syu vs -Sy).
- Fix wrapper scripts to pass a single operation flag set.
Example fix
# before paru -Syu -Q # after paru -Syu paru -Qu
Defensive patterns
Strategy: validation
Validate before calling
let ops = ["S","Q","G","P","C","L","G"].iter().filter(|op| args.iter().any(|a| a.starts_with('-') && a.contains(op))).count();
if ops > 1 { panic!("only one operation may be used at a time"); } Try / catch
// wrapper that validates before exec
let ops: usize = count_operation_flags(&argv);
if ops > 1 {
eprintln!("only one operation may be used at a time");
std::process::exit(1);
} Prevention
- One operation flag per invocation; chain with && in scripts instead.
- Double-check combined short flags like -Syu for stray op letters.
- Keep wrapper scripts restricted to a single fixed operation.
When it happens
Trigger: Invoking paru with two or more operation flags in one command: `paru -Syu -Q`, `paru -Ss -Sl`, `paru -G -S pkg`, including combined short flags like `-Sqi` where both S and Q... (any two op letters) appear.
Common situations: Scripting mistakes concatenating operations; muscle-memory combining pacman-style ops that pacman also rejects; users expecting -Qu plus -S behavior in one call.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- no targets specified (use -h for help)
- repository " " was not found
- option expects a value
- unknown option
- unknown option
AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12).
Data as JSON: /api/errors/40be74e78ae47efe.
Report an issue: GitHub.
Appendix: source
Thrown at src/config.rs:682
pub fn parse_args<S: AsRef<str>, I: IntoIterator<Item = S>>(&mut self, iter: I) -> Result<()> {
let iter = iter.into_iter();
let mut iter = iter.peekable();
let mut op_count = 0;
let mut end_of_ops = false;
if let Ok(aurdest) = var("AURDEST") {
self.build_dir = aurdest.into();
}
while let Some(arg) = iter.next() {
let value = iter.peek().map(|s| s.as_ref());
let arg = arg.as_ref();
if self.parse_arg(arg, value, &mut op_count, &mut end_of_ops)? {
iter.next();
}
ensure!(
op_count <= 1,
tr!("only one operation may be used at a time")
);
}
if let Some((i, _)) = self.targets.iter().enumerate().find(|t| t.1 == "-") {
self.targets.remove(i);
self.parse_stdin()?;
reopen_stdin()?;
}
self.args.op = self.op.as_str().to_string();
self.args.targets = self.targets.clone();
self.args.bin = self.pacman_bin.clone();
self.globals.op = self.op.as_str().to_string();
self.globals.bin = self.pacman_bin.clone();
View on GitHub (pinned to 9ac3578807)