nikivdev/code · error
failed to store AI token in Keychain
Error message
failed to store AI token in Keychain
What it means
Error "failed to store AI token in Keychain" thrown in nikivdev/code.
Source
Thrown at src/env.rs:309
}
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()
.context("failed to store AI token in Keychain")?;
if !status.success() {
bail!("failed to store AI token in Keychain");
}
Ok(())
}
fn get_keychain_token(api_url: &str) -> Result<Option<String>> {
if !cfg!(target_os = "macos") {
return Ok(None);
}
let service = keychain_service(api_url);
let output = Command::new("security")
.args(["find-generic-password", "-a", "flow", "-s", &service, "-w"])
.output()
.context("failed to read token from Keychain")?;
if output.status.success() {
let token = String::from_utf8_lossy(&output.stdout).trim().to_string();
if token.is_empty() {View on GitHub (pinned to a747e741ae)
When it happens
Trigger: Thrown at src/env.rs:309 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/d1ca44a7bd111450.
Report an issue: GitHub.