nikivdev/code · error

failed to store token in Keychain

Error message

failed to store token in Keychain

What it means

Error "failed to store token in Keychain" thrown in nikivdev/code.

Source

Thrown at src/env.rs:288

}

fn set_keychain_token(api_url: &str, token: &str) -> Result<()> {
    let service = keychain_service(api_url);
    let status = Command::new("security")
        .args([
            "add-generic-password",
            "-a",
            "flow",
            "-s",
            &service,
            "-w",
            token,
            "-U",
        ])
        .status()
        .context("failed to store token in Keychain")?;
    if !status.success() {
        bail!("failed to store token in Keychain");
    }
    Ok(())
}

fn set_keychain_ai_token(api_url: &str, token: &str) -> Result<()> {
    let service = keychain_service_ai(api_url);
    let status = Command::new("security")
        .args([
            "add-generic-password",
            "-a",
            "flow",
            "-s",
            &service,
            "-w",
            token,
            "-U",
        ])
        .status()

View on GitHub (pinned to a747e741ae)

When it happens

Trigger: Thrown at src/env.rs:288 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/cba4bbc3b72db497. Report an issue: GitHub.