openai/codex · error

timed out after {acquire_timeout:?} waiting for OAuth refres

Error message

timed out after {acquire_timeout:?} waiting for OAuth refresh lock {}

What it means

Error "timed out after {acquire_timeout:?} waiting for OAuth refresh lock {}" thrown in openai/codex.

Source

Thrown at codex-rs/rmcp-client/src/oauth/refresh_lock.rs:91

                    Ok(()) => return Ok(()),
                    Err(std::fs::TryLockError::WouldBlock) => {
                        if !reported_contention {
                            tracing::debug!(
                                target: LOCK_CONTENTION_EVENT_TARGET,
                                lock_path = %path.display(),
                                "waiting for another process to finish refreshing MCP OAuth credentials"
                            );
                            reported_contention = true;
                        }
                        sleep(REFRESH_LOCK_RETRY_SLEEP).await;
                    }
                    Err(error) => return Err(std::io::Error::from(error)),
                }
            }
        })
        .await
        .map_err(|_| {
            anyhow!(
                "timed out after {acquire_timeout:?} waiting for OAuth refresh lock {}",
                path.display()
            )
        })?
        .with_context(|| format!("failed to lock OAuth refresh lock {}", path.display()))?;

        Ok(Self { _file: file })
    }
}

#[cfg(test)]
#[path = "refresh_lock_tests.rs"]
mod tests;

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/rmcp-client/src/oauth/refresh_lock.rs:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/ba5d236d61cb82b9. Report an issue: GitHub.