openai/codex · error · ReadinessError
FlagAlreadyReady
FlagAlreadyReady
Error message
Flag is already ready. Impossible to subscribe
What it means
ReadinessError::FlagAlreadyReady, a thiserror-defined sentinel variant. It fires when a caller attempts to subscribe to readiness change notifications for a flag whose value is already true; there is no future transition to await, so a subscription is impossible.
Solutions
- Check the flag's current value before subscribing and treat an already-ready flag as immediately complete instead of subscribing
- Use the watch channel fast-path check (borrow() == true) to short-circuit before calling subscribe
- Restructure code so subscriptions are created only once, before the flag can be set
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at codex-rs/utils/readiness/src/lib.rs:196 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/e80bc69c0b862604.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/utils/readiness/src/lib.rs:196
return;
}
// Await changes until true is observed.
while rx.changed().await.is_ok() {
if *rx.borrow() {
break;
}
}
}
}
mod errors {
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ReadinessError {
#[error("Failed to acquire readiness token lock")]
TokenLockFailed,
#[error("Flag is already ready. Impossible to subscribe")]
FlagAlreadyReady,
}
}
#[cfg(test)]
mod tests {
use std::sync::Arc;
use std::sync::atomic::Ordering;
use super::Readiness;
use super::ReadinessFlag;
use super::Token;
use super::errors::ReadinessError;
use assert_matches::assert_matches;
#[tokio::test]
async fn subscribe_and_mark_ready_roundtrip() -> Result<(), ReadinessError> {
let flag = ReadinessFlag::new();View on GitHub (pinned to 339751715c)