jdx/mise · error
GitHub Actions OIDC token expires too soon
Error message
GitHub Actions OIDC token expires too soon
What it means
The GitHub Actions OIDC provider returned a token whose JWT expiry is not far enough in the future relative to REFRESH_LEEWAY_SECONDS. The client refuses to cache tokens that would expire almost immediately, because they could not be safely reused. This indicates an issuer/configuration problem rather than a transient failure.
Solutions
- Ensure the OIDC request URL points at the genuine GitHub Actions token endpoint ($ACTIONS_ID_TOKEN_REQUEST_URL) rather than a stub
- Check runner/system clock skew (NTP sync) so 'now' is not drifted ahead of the token's iat/exp
- Decode the returned JWT and inspect its exp claim to see who issued it and when it expires
- Request a fresh token rather than relying on an externally supplied one
Example fix
// before: custom/stub token endpoint with near-expiry tokens
let url = "http://localhost:9999/token";
// after: use the GitHub-provided endpoint
let url = std::env::var("ACTIONS_ID_TOKEN_REQUEST_URL")?; Defensive patterns
Strategy: validation
Validate before calling
// before requesting, confirm we're using the genuine GitHub endpoint
let url = std::env::var("ACTIONS_ID_TOKEN_REQUEST_URL")
.expect("ACTIONS_ID_TOKEN_REQUEST_URL must be set by GitHub Actions");
assert!(url.starts_with("http"), "OIDC URL not configured"); Type guard
fn has_future_expiry(token: &str, leeway_secs: u64, now: u64) -> bool {
jwt_expiry(token).map(|exp| exp > now + leeway_secs).unwrap_or(false)
} Try / catch
match provider.token(audience).await {
Err(e) if e.to_string().contains("expires too soon") => {
// check clock skew / issuer before retrying
}
other => other,
} Prevention
- Sync runner clocks with NTP
- Only point OIDC requests at the GitHub-provided ACTIONS_ID_TOKEN_REQUEST_URL
- Log the JWT header/claims (not the signature) when debugging issuers
When it happens
Trigger: jwt_expiry(&response.value) returns a timestamp <= now + REFRESH_LEEWAY_SECONDS while acquiring a GitHub Actions OIDC token for the configured audience.
Common situations: A non-GitHub endpoint mimicking the OIDC provider returning hand-rolled tokens with short/no expiry, clock skew between runner and token issuer, misconfigured ACTIONS_ID_TOKEN_REQUEST_URL pointing at a stub server.
Related errors
- could not fetch setup repository using local Git…
- GitHub Actions OIDC request URL must use HTTPS
- GitHub device authorization was denied
- manifest push failed
- no GitHub token found for
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/48fc5d24d1e7914b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/mise-cache-core/src/lib.rs:1060
.client
.get(self.request_url.clone())
.header(AUTHORIZATION, self.request_token.clone())
.send()
.await?
.error_for_status()?
.json()
.await?)
})
.await
.map_err(|err| {
eyre!(
"failed to acquire GitHub Actions OIDC token for audience {:?}: {err}",
self.audience
)
})?;
let expires_at = jwt_expiry(&response.value)?;
if expires_at <= now.saturating_add(REFRESH_LEEWAY_SECONDS) {
bail!("GitHub Actions OIDC token expires too soon");
}
let authorization = authorization_header(Some(&response.value))?
.ok_or_else(|| eyre!("GitHub Actions returned an empty OIDC token"))?;
*cached = Some(CachedOidcToken {
authorization: authorization.clone(),
expires_at,
});
Ok(authorization)
}
}
fn jwt_expiry(token: &str) -> Result<u64> {
let payload = token
.split('.')
.nth(1)
.ok_or_else(|| eyre!("GitHub Actions returned a malformed OIDC token"))?;
let payload = URL_SAFE_NO_PAD
.decode(payload)View on GitHub (pinned to 533346cc37)