ErrLookupBackground articles › "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

"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

"Mutually exclusive" and "cannot be combined" errors appear when you pass two command-line flags or options that cannot be used together — like "can't supply both nx and xx", "Raw is not compatible with interactive", or "Only one of --tag, --rev and --branch can be specified". They are client-side or preflight rejections, not runtime faults: the tool checked its arguments before doing any work and refused a contradictory request. This article explains why libraries enforce flag exclusivity, which combinations trigger it across CLIs, SDKs and code generators, and how to fix wrapper scripts and configs that keep producing these errors.

Distilled from 100 documented records across 29 repositories.

Background

This family covers errors raised when a caller supplies two or more options whose meanings contradict each other. The messages vary in phrasing — 'mutually exclusive', 'not compatible with', 'can't supply both', 'cannot be used with', 'contradict each other' — but the mechanism is the same: the option set cannot be satisfied simultaneously, so the program aborts instead of picking a winner silently.

Most of these errors are produced very early, before real work starts. Client libraries like redis-rb raise ArgumentError for JSON.SET's nx/xx pair and GEOADD's NX/XX flags before anything reaches the server, mirroring a server that would reject the command anyway. CLI tools like Kamal ('Raw is not compatible with interactive'), Mastra's create command, Archon's workflow preflight, and whenever's crontab action check ('Can only update, write or clear. Choose one.') all validate their option objects at command dispatch and raise before connecting to hosts or touching the filesystem. Some validate even earlier: Phabricator raises PhutilArgumentUsageException during argument parsing, and Cilium's Hubble redaction check surfaces at agent startup when the config cell is instantiated.

The reasons for exclusivity are consistent across the family. Some flags select opposite modes of the same choice: whenever's update/write/clear crontab actions, Redis JSON's nx (only when absent) vs xx (only when present), oh-my-posh's --data-only (forbid probing) vs --data-derive (force probing), Bundler's --major/--minor/--patch update levels. Others select different mechanisms for the same output: openapi-generator's returnResponse vs returnJBossResponse, or its Swagger v2/v3/MicroProfile annotation flags, where templates can emit only one style. A third pattern is structural: a single downstream artifact can only encode one choice, as with Tauri's npm repo#ref spec accepting exactly one git ref, or Deno's dcore accepting one inspector flag per invocation.

A recurring trap is that the conflicting flags often come from different sources rather than a single typed command: a wrapper script with hardcoded flags plus env vars adding more (whenever, CodeWhale, grok-build), option hashes merged from defaults and user input (redis-rb), or config keys resurrected during migrations (openapi-generator's response-style flags). Some tools guard against the combination even when the normal flow makes it nearly unreachable — openapi-generator force-disables useSwaggerAnnotations when v3 is requested, so that guard mainly protects programmatic setter sequences. Notably, a few checks fire only after partial work: Hadoop's createEncryptionZone creates the zone before checking PROVISION_TRASH vs NO_TRASH, so the caller must clean up a half-configured zone — most other tools in this family fail fast with no side effects.

Common causes

What usually fixes it

Documented occurrences

…and 80 more across the corpus — use search.

Honest provenance: generated on 2026-09-01 from AI-assisted analysis of the linked records. See how records are made.