{"record":{"id":"f65b12a53598b2f0","repo":"jdx/mise","slug":"relay-options-require-github-relay-read-only","errorCode":null,"errorMessage":"relay options require --github-relay-read-only","messagePattern":"relay options require --github-relay-read-only","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":86,"sourceCode":"            jsonl: false,\n            max_duration: std::time::Duration::ZERO,\n            request_timeout: std::time::Duration::from_secs(300),\n            concurrency: 8,\n        }\n    }\n}\n\n/// Resolve observability and limits only after explicit access authorization.\npub(crate) fn configure(\n    scope: Option<Scope>,\n    log_requests: bool,\n    no_log_requests: bool,\n    format: Option<&str>,\n    max_duration: Option<&str>,\n) -> Result<Option<Scope>> {\n    let Some(scope) = scope else {\n        if log_requests || no_log_requests || format.is_some() || max_duration.is_some() {\n            bail!(\"relay options require --github-relay-read-only\");\n        }\n        return Ok(None);\n    };\n    let settings = crate::config::Settings::get();\n    let settings = &settings.github_relay;\n    let format = format.unwrap_or(&settings.log_format);\n    if !matches!(format, \"text\" | \"jsonl\") {\n        bail!(\"relay log format must be text or jsonl\");\n    }\n    let timeout = duration::parse_duration(&settings.request_timeout)?;\n    if timeout.is_zero() {\n        bail!(\"relay request timeout must be greater than zero\");\n    }\n    if !(1..=32).contains(&settings.concurrency) {\n        bail!(\"relay concurrency must be between 1 and 32\");\n    }\n    let max_duration = duration::parse_duration(max_duration.unwrap_or(&settings.max_duration))?;\n    if std::time::Instant::now().checked_add(timeout).is_none()","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/github_relay.rs#L68-L104","documentation":"GitHubRelay::configure validates that relay observability options (--github-relay-log-requests, --github-relay-no-log-requests, --github-relay-log-format, --github-relay-max-duration) are only accepted when the relay is enabled. When scope is None (relay off) but any of these options was supplied, it bails instead of ignoring them.","triggerScenarios":"configure is called (from npm_command or cli_observability_overrides) with scope=None while log_requests, no_log_requests, format, or max_duration is Some/true — e.g. `mise --github-relay-log-requests exec ...` without --github-relay-read-only.","commonSituations":"Global mise arguments like log-format flags set in an alias while the relay is disabled in this project; scripts passing relay flags unconditionally; documentation examples that omit the enable flag.","solutions":["Enable the relay by adding --github-relay-read-only (and the repo scope flags) so the options apply.","Remove the relay log options when the relay is disabled.","Move relay/log configuration into mise.toml under [github_relay] where it is validated together with the enabled flag."],"exampleFix":"// before\nmise --github-relay-log-requests exec -- npm install\n// after\nmise --github-relay-read-only --github-relay-repo owner/repo --github-relay-log-requests exec -- npm install","handlingStrategy":"validation","validationCode":"# shell: only pass log flags when relay enabled\nflags=\"\"\nif $RELAY_ENABLED; then flags=\"$flags --github-relay-log-requests\"; fi","typeGuard":"fn relay_options_allowed(scope: &Option<Scope>, log: bool, fmt: Option<&str>, dur: Option<&str>) -> bool {\n    scope.is_some() || !(log || fmt.is_some() || dur.is_some())\n}","tryCatchPattern":"match configure(scope, log_requests, no_log_requests, format, max_duration) {\n    Err(e) if e.to_string().contains(\"require --github-relay-read-only\") => {\n        // re-invoke with the relay enabled or the log flags removed\n    }\n    r => r,\n}","preventionTips":["Gate all --github-relay-log-* / max-duration flags behind an enabled relay.","Centralize relay flag assembly in one script or mise.toml block.","Audit global aliases that append relay log options unconditionally."],"tags":["cli","github-relay","flags","configuration"],"backgroundTag":"missing-required-flag","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}