zed-industries/zed · error
token is not yet valid
Error message
token is not yet valid
What it means
Claim check in validate_with_timestamp_source: the token's nbf (not-before) claim is later than the timestamp source's current time, so the token is structurally valid but not yet active. This is a test-support validator comparing claims against an injected clock.
Source
Thrown at crates/livekit_api/src/token.rs:173
#[cfg(any(test, feature = "test-support"))]
pub fn validate_with_timestamp_source<'a>(
token: &'a str,
secret_key: &str,
timestamp_source: &dyn UnixTimestampSource,
) -> Result<ClaimGrants<'a>> {
let mut validation = Validation::default();
validation.validate_exp = false;
validation.validate_nbf = false;
let token: jsonwebtoken::TokenData<ClaimGrants<'_>> = jsonwebtoken::decode(
token,
&DecodingKey::from_secret(secret_key.as_ref()),
&validation,
)?;
let claims = token.claims;
let timestamp = timestamp_source.unix_timestamp()?;
anyhow::ensure!(claims.nbf <= timestamp, "token is not yet valid");
anyhow::ensure!(claims.exp > timestamp, "token has expired");
Ok(claims)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::{Client as _, LiveKitClient};
use std::sync::Arc;
const ISSUED_AT: u64 = 1_234_567;
struct FixedUnixTimestampSource(u64);
impl UnixTimestampSource for FixedUnixTimestampSource {
fn unix_timestamp(&self) -> Result<u64> {
Ok(self.0)View on GitHub (pinned to f4178619ac)
Solutions
- Wait until the token's not-before time passes, or request a token valid now
- Correct the clock/timestamp source used when issuing or validating the token
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/livekit_api/src/token.rs:173 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/0f7d0fe57f172c2b.
Report an issue: GitHub.