jdx/mise · error

choose --github-relay-repo OWNER/REPO or…

Error message

choose --github-relay-repo OWNER/REPO or --github-relay-all-repos, not both

What it means

from_flags rejects mutually exclusive repository scoping: --github-relay-all-repos (all=true) and explicit --github-relay-repo entries are contradictory. The guard `all != repositories.is_empty()` fires when exactly one side is set incorrectly — specifically when both are given (all=true AND repos present), or when neither is given while relay is enabled is allowed implicitly? No: it fires when all=true together with a non-empty repositories list (both selected), since enabling relay with neither falls through to all=false/empty which means no scope restriction.

Solutions

  1. Keep only --github-relay-all-repos to relay every repository
  2. Or keep only the --github-relay-repo OWNER/REPO flags for an explicit allowlist
  3. Review the full command line/scripts for duplicated relay scope options

Example fix

// before
mycli --github-relay-read-only --github-relay-all-repos --github-relay-repo org/repo
// after (pick one)
mycli --github-relay-read-only --github-relay-all-repos
// or
mycli --github-relay-read-only --github-relay-repo org/repo
Defensive patterns

Strategy: validation

Validate before calling

// Exactly one scoping mode must be chosen
let has_repos = args.iter().any(|a| a.starts_with("--github-relay-repo"));
let has_all = args.iter().any(|a| a == "--github-relay-all-repos");
if has_repos && has_all { panic!("choose one relay scope mode, not both"); }

Try / catch

match err {
    RelayConfigError::ConflictingScope => eprintln!("use --github-relay-all-repos OR --github-relay-repo, not both"),
    e => return Err(e),
}

Prevention

When it happens

Trigger: Calling from_flags(enabled=true, repositories=[...], all=true) — both --github-relay-all-repos and one or more --github-relay-repo flags present on the command line.

Common situations: Building a command incrementally and leaving an old --github-relay-repo flag in place after switching to --github-relay-all-repos; a generated or templated command emitting both options.

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


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

Appendix: source

Thrown at src/github_relay.rs:29

    repositories: std::collections::BTreeSet<String>,
    #[cfg(any(unix, test))]
    all: bool,
}

impl Scope {
    pub(crate) fn from_flags(
        enabled: bool,
        repositories: &[String],
        all: bool,
    ) -> Result<Option<Self>> {
        if !enabled {
            if all || !repositories.is_empty() {
                bail!("repository scope requires --github-relay-read-only");
            }
            return Ok(None);
        }
        if all != repositories.is_empty() {
            bail!("choose --github-relay-repo OWNER/REPO or --github-relay-all-repos, not both");
        }
        let repositories: std::collections::BTreeSet<String> = repositories
            .iter()
            .map(|repo| repository(repo))
            .collect::<Result<_>>()?;
        #[cfg(not(any(unix, test)))]
        let _ = repositories;
        Ok(Some(Self {
            #[cfg(unix)]
            options: Options::default(),
            #[cfg(any(unix, test))]
            repositories,
            #[cfg(any(unix, test))]
            all,
        }))
    }

    #[cfg(any(unix, test))]

View on GitHub (pinned to 533346cc37)