openai/codex · error · OAuthStoreLockFailure

failed to open MCP OAuth

Error message

failed to open MCP OAuth {store} aggregate-store lock {}

What it means

Raised when opening the MCP OAuth aggregate-store lock file failed with an I/O error, meaning the lock path exists but could not be opened for locking (permissions problem, or the path is a directory/special file rather than a lock file).

Solutions

  1. Check permissions on the lock file and its parent directory
  2. Delete a corrupt or wrongly-typed lock path (e.g. a directory) so it is recreated
  3. Verify CODEX_HOME is on a filesystem that supports flock (not some network mounts)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/rmcp-client/src/oauth/store_lock.rs:181 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/170495cff3153cb7. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rmcp-client/src/oauth/store_lock.rs:181

/// Auto may fall back when the configured keyring backend is unavailable, but it must surface a
/// lock failure. Falling back while another process owns the aggregate-store lock could leave the
/// newer credential in File while a stale Secrets entry remains preferred.
#[derive(Debug, thiserror::Error)]
pub(super) enum OAuthStoreLockFailure {
    #[error("failed to resolve CODEX_HOME for MCP OAuth {store} aggregate-store lock")]
    CodexHome {
        store: OAuthStore,
        #[source]
        source: io::Error,
    },
    #[error("failed to create MCP OAuth {store} aggregate-store lock directory {}", path.display())]
    CreateDir {
        store: OAuthStore,
        path: PathBuf,
        #[source]
        source: io::Error,
    },
    #[error("failed to open MCP OAuth {store} aggregate-store lock {}", path.display())]
    Open {
        store: OAuthStore,
        path: PathBuf,
        #[source]
        source: io::Error,
    },
    #[error(
        "timed out after {acquire_timeout:?} waiting for MCP OAuth {store} aggregate-store lock {}",
        path.display()
    )]
    Timeout {
        store: OAuthStore,
        path: PathBuf,
        acquire_timeout: Duration,
    },
    #[error("failed to lock MCP OAuth {store} aggregate-store lock {}", path.display())]
    Lock {
        store: OAuthStore,

View on GitHub (pinned to 339751715c)