{"record":{"id":"8d6939ea4ff507ad","repo":"jdx/mise","slug":"invalid-github-relay-timeout-policy","errorCode":null,"errorMessage":"invalid GitHub relay timeout policy","messagePattern":"invalid GitHub relay timeout policy","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":1026,"sourceCode":"        let response = builder()\n            .build()?\n            .get(\"http://localhost/_session\")\n            .timeout(Duration::from_secs(3))\n            .send()\n            .await\n            .map_err(|error| {\n                eyre::Report::new(error.without_url()).wrap_err(\"GitHub relay policy unavailable\")\n            })?;\n        if response.status() != 204 {\n            bail!(\"GitHub relay is not connected\");\n        }\n        let value = response\n            .headers()\n            .get(\"x-mise-relay-timeout\")\n            .ok_or_else(|| eyre::eyre!(\"GitHub relay timeout policy missing\"))?;\n        let timeout: Duration = serde_json::from_slice(value.as_bytes())?;\n        if timeout.is_zero() || std::time::Instant::now().checked_add(timeout).is_none() {\n            bail!(\"invalid GitHub relay timeout policy\");\n        }\n        Ok((builder().read_timeout(timeout).build()?, timeout))\n    }\n\n    // Bound connecting and writing as well as waiting for response headers.\n    // The client's read timeout separately protects the streamed response.\n    async fn send_adapter_request(\n        req: reqwest::RequestBuilder,\n        timeout: Duration,\n    ) -> Result<reqwest::Response> {\n        tokio::time::timeout(timeout, req.send())\n            .await\n            .map_err(|_| eyre::eyre!(\"GitHub relay request setup timed out\"))?\n            .map_err(|error| {\n                eyre::Report::new(error.without_url())\n                    .wrap_err(\"GitHub relay disconnected or unavailable\")\n            })\n    }","sourceCodeStart":1008,"sourceCodeEnd":1044,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/github_relay.rs#L1008-L1044","documentation":"The connected relay advertises its timeout policy in the x-mise-relay-timeout header, parsed as a Duration. adapter_client validates that the duration is non-zero and that it can be added to the current instant without overflow; a zero duration or an unparseable/overflowing value is rejected with \"invalid GitHub relay timeout policy\" so the client never builds a client with a useless or overflowing read timeout.","triggerScenarios":"The relay responds 204 but its x-mise-relay-timeout header is missing-valid: it's \"0\", absent of proper Duration serialization, corrupted, or absurdly large enough to overflow Instant::checked_add.","commonSituations":"Version mismatch between client and relay where the header format changed; a broken/patched relay build emitting a zero timeout; proxy middleware stripping or mangling the custom header.","solutions":["Update the relay and client to matching versions so the x-mise-relay-timeout header is serialized consistently.","Restart the session to get a fresh relay process emitting a valid timeout policy.","Remove any intermediary proxy on the relay's loopback path that could strip or rewrite the custom header."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"invalid GitHub relay timeout policy\") => {\n        // restart the relay/session to get a fresh, valid header\n    }\n    other => other?,\n}","preventionTips":["Keep relay and client versions in sync so the header format matches.","Don't put proxies or middleware on the relay's loopback path that could mangle headers.","Treat a zero timeout in the header as a relay bug and fail fast with a restart."],"tags":["configuration","timeout","relay","protocol"],"backgroundTag":"invalid-config-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}