openai/codex · error · OAuthStoreLockFailure

failed to lock MCP OAuth

Error message

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

What it means

Raised when the attempt to take the MCP OAuth aggregate-store flock failed with an unexpected I/O error (not WouldBlock), e.g. a filesystem error during the lock syscall; unlike the timeout case this indicates a broken or hostile lock file rather than simple contention.

Solutions

  1. Inspect the io::Error source for the underlying filesystem problem
  2. Recreate the lock file after checking permissions and filesystem health
  3. Move CODEX_HOME to a local filesystem that supports flock
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

        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,
        path: PathBuf,
        #[source]
        source: io::Error,
    },
}

fn oauth_store_lock_path(codex_home: &Path, store: OAuthStore) -> PathBuf {
    codex_home.join(OAUTH_LOCK_DIR).join(store.lock_filename())
}

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

View on GitHub (pinned to 339751715c)