openai/codex · error · OAuthStoreLockFailure

failed to create MCP OAuth

Error message

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

What it means

Raised when creating the directory that holds the MCP OAuth aggregate-store lock file failed with an I/O error — typically missing CODEX_HOME directories, insufficient permissions, or the path existing as a non-directory.

Solutions

  1. Verify CODEX_HOME points to a writable location
  2. Create or repair the lock directory manually and fix its permissions
  3. Check for a file occupying the lock directory's path and remove it
  4. Ensure no antivirus/policy is blocking directory creation
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

                    });
                }
            }
        }
    }
}

/// 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 {

View on GitHub (pinned to 339751715c)