jdx/mise · error

relay options require --github-relay-read-only

Error message

relay options require --github-relay-read-only

What it means

GitHubRelay::Scope::configure applies log/observability settings to an existing relay scope. If no relay scope exists (scope=None) but log-related relay flags were passed (--log-requests, --no-log-requests, a log format, or a max duration), it bails: those options only make sense when the relay is enabled via --github-relay-read-only.

Solutions

  1. Enable the relay first with --github-relay-read-only, then pass the log options
  2. Remove the relay log/format/duration flags when the relay is disabled
  3. Check that the code path creating the Scope ran successfully before configure is called

Example fix

// before
mycli --github-relay-log-requests
// after
mycli --github-relay-read-only --github-relay-log-requests
Defensive patterns

Strategy: validation

Validate before calling

// Only pass log flags when the relay scope exists
let log_flags = args.iter().filter(|a| a.starts_with("--github-relay-log")).count();
if log_flags > 0 && !args.contains(&"--github-relay-read-only") {
    panic!("relay log options require --github-relay-read-only");
}

Try / catch

match err {
    RelayConfigError::LogOptionsWithoutScope => eprintln!("enable --github-relay-read-only before using relay log options"),
    e => return Err(e),
}

Prevention

When it happens

Trigger: Calling configure (via npm_command or cli_observability_overrides) with scope=None and any of log_requests=true, no_log_requests=true, format=Some(_), or max_duration=Some(_).

Common situations: Passing --github-relay-log-format or --github-relay-max-duration without first enabling --github-relay-read-only; running an npm subcommand that forwards relay observability flags when the relay was never turned on.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/github_relay.rs:86

            jsonl: false,
            max_duration: std::time::Duration::ZERO,
            request_timeout: std::time::Duration::from_secs(300),
            concurrency: 8,
        }
    }
}

/// Resolve observability and limits only after explicit access authorization.
pub(crate) fn configure(
    scope: Option<Scope>,
    log_requests: bool,
    no_log_requests: bool,
    format: Option<&str>,
    max_duration: Option<&str>,
) -> Result<Option<Scope>> {
    let Some(scope) = scope else {
        if log_requests || no_log_requests || format.is_some() || max_duration.is_some() {
            bail!("relay options require --github-relay-read-only");
        }
        return Ok(None);
    };
    let settings = crate::config::Settings::get();
    let settings = &settings.github_relay;
    let format = format.unwrap_or(&settings.log_format);
    if !matches!(format, "text" | "jsonl") {
        bail!("relay log format must be text or jsonl");
    }
    let timeout = duration::parse_duration(&settings.request_timeout)?;
    if timeout.is_zero() {
        bail!("relay request timeout must be greater than zero");
    }
    if !(1..=32).contains(&settings.concurrency) {
        bail!("relay concurrency must be between 1 and 32");
    }
    let max_duration = duration::parse_duration(max_duration.unwrap_or(&settings.max_duration))?;
    if std::time::Instant::now().checked_add(timeout).is_none()

View on GitHub (pinned to 533346cc37)