{"record":{"id":"0dce8e7f522999ff","repo":"jdx/mise","slug":"relay-concurrency-must-be-between-1-and-32","errorCode":null,"errorMessage":"relay concurrency must be between 1 and 32","messagePattern":"relay concurrency must be between 1 and 32","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":101,"sourceCode":") -> 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()\n        || std::time::Instant::now()\n            .checked_add(max_duration)\n            .is_none()\n    {\n        bail!(\"relay duration is too large\");\n    }\n    #[cfg(not(unix))]\n    let _ = max_duration;\n    #[cfg(unix)]\n    let scope = {\n        let mut scope = scope;\n        scope.options = Options {\n            log_requests: !no_log_requests && (log_requests || settings.log_requests),\n            jsonl: format == \"jsonl\",\n            max_duration,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/github_relay.rs#L83-L119","documentation":"The GitHub relay's `configure` function validates that the `concurrency` setting for relayed GitHub requests is an integer between 1 and 32 inclusive. This guard prevents spawning an unbounded number of parallel relay connections, which could exhaust connections or trip GitHub rate limits. It is thrown via `bail!` before the relay is started, so configuration fails fast.","triggerScenarios":"Calling `configure` (via `npm_command` or `cli_observability_overrides`) with a settings object whose `concurrency` field is 0, negative, or greater than 32 — e.g. `MISE_GITHUB_RELAY_CONCURRENCY=50` or a parsed config value of 0.","commonSituations":"Users tuning relay throughput set an env var or config key to a large number assuming more is better; a missing/empty value parses to 0; or a default copied from another tool's limit (e.g. 64) exceeds this library's 32 ceiling.","solutions":["Set the relay concurrency setting to an integer in the 1..=32 range (e.g. 16).","Check the environment variable or config file supplying `concurrency` for typos, empty values, or out-of-range numbers.","Lower any value copied from a different tool's recommended settings to at most 32."],"exampleFix":"// before\nMISE_GITHUB_RELAY_CONCURRENCY=64\n// after\nMISE_GITHUB_RELAY_CONCURRENCY=16","handlingStrategy":"validation","validationCode":"fn valid_relay_concurrency(c: u32) -> bool { (1..=32).contains(&c) }\nif !valid_relay_concurrency(settings.concurrency) { /* fix before calling configure */ }","typeGuard":"fn in_relay_concurrency_range(n: i64) -> Option<u32> {\n    (1..=32).contains(&n).then(|| n as u32)\n}","tryCatchPattern":"match relay::configure(&settings, None) {\n    Err(e) if e.to_string().contains(\"concurrency\") => eprintln!(\"clamp concurrency to 1..=32: {e}\"),\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Clamp user-supplied concurrency with `.clamp(1, 32)` before building settings.","Treat the 1..=32 bound as an invariant; document it next to the setting definition.","Add a unit test that config parsing rejects 0 and 33."],"tags":["config","relay","concurrency","validation"],"backgroundTag":"value-out-of-range","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"}