jdx/mise · error
invalid GitHub relay timeout policy
Error message
invalid GitHub relay timeout policy
What it means
`adapter_client` reads the relay timeout policy from the `x-mise-relay-timeout` response header and deserializes it into a Duration. If the value is zero or too large to add to the current instant (i.e. overflowing `Instant`), the policy is considered invalid and the error is raised. It protects callers from a nonsensical or unusable timeout.
Solutions
- Update both the relay and mise so the x-mise-relay-timeout header format matches between versions.
- Check what the relay is sending (inspect the header with a proxy or relay logs) and correct the emitting side.
- If you control a stub/mock relay, emit a positive, sane Duration value in the expected serde format.
- As a workaround, run without the relay (direct GitHub access) if your environment permits.
Defensive patterns
Strategy: try-catch
Try / catch
let (client, timeout) = match adapter_client(&socket).await {
Err(e) if e.to_string().contains("invalid GitHub relay timeout policy") => {
eprintln!("relay timeout header invalid; using default timeout");
fallback_client_with_default_timeout(&socket).await?
}
other => other?,
}; Prevention
- Run matching relay and mise versions so the x-mise-relay-timeout format agrees
- Never stub the header with 0 or malformed durations in test relays
- Validate advertised timeout headers when operating a custom relay
When it happens
Trigger: The relay advertises `x-mise-relay-timeout` as 0; the header contains a Duration value that fails serde parsing (wrong format/type) — surfacing a parse error instead; the header contains a huge duration that overflows Instant::checked_add.
Common situations: Version mismatch between relay server and client where the header format changed; a misbehaving or mocked relay emitting an invalid header; tests/stubs that set the header to `0` to disable timeouts.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- HTTP download timed out after
- unexpected request body
- a provided source resolves to a path
- additional asset ' ' is not an archive
- agent ' ' `start_calendar_interval. ` must be between and
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/8d6939ea4ff507ad.
Report an issue: GitHub.
Appendix: source
Thrown at src/github_relay.rs:1036
let response = builder()
.build()?
.get("http://localhost/_session")
.timeout(Duration::from_secs(3))
.send()
.await
.map_err(|error| {
eyre::Report::new(error.without_url()).wrap_err("GitHub relay policy unavailable")
})?;
if response.status() != 204 {
bail!("GitHub relay is not connected");
}
let value = response
.headers()
.get("x-mise-relay-timeout")
.ok_or_else(|| eyre::eyre!("GitHub relay timeout policy missing"))?;
let timeout: Duration = serde_json::from_slice(value.as_bytes())?;
if timeout.is_zero() || std::time::Instant::now().checked_add(timeout).is_none() {
bail!("invalid GitHub relay timeout policy");
}
Ok((builder().read_timeout(timeout).build()?, timeout))
}
// Bound connecting and writing as well as waiting for response headers.
// The client's read timeout separately protects the streamed response.
async fn send_adapter_request(
req: reqwest::RequestBuilder,
timeout: Duration,
) -> Result<reqwest::Response> {
tokio::time::timeout(timeout, req.send())
.await
.map_err(|_| eyre::eyre!("GitHub relay request setup timed out"))?
.map_err(|error| {
eyre::Report::new(error.without_url())
.wrap_err("GitHub relay disconnected or unavailable")
})
}View on GitHub (pinned to 533346cc37)