tonhowtf/omniget · error
chave nao encontrada
Error message
chave nao encontrada
What it means
ai_keys::get scans the persisted key list for an entry with the given id and fails with "chave nao encontrada" ("key not found") when no entry matches. The id is treated as a resource identifier; a miss is a lookup failure on the stored key registry.
Solutions
- List existing keys (load()/list API) and confirm the id before calling get
- Refresh stale ids in the UI after any delete/upsert operation
- Verify the keys JSON file still exists and contains the expected entries
- Pass the exact KeyEntry::id string, not a provider name or label
Example fix
// before
let entry = get(&id).await?;
// after
let Some(entry) = list().into_iter().find(|e| e.id == id) else {
return Err(anyhow!("chave nao encontrada: {} — liste as chaves e use um id valido", id));
}; Defensive patterns
Strategy: validation
Validate before calling
fn key_exists(id: &str) -> bool { load().iter().any(|e| e.id == id) }
// call before get():
if !key_exists(id) { return Err(anyhow!("id desconhecido: {}", id)); } Try / catch
match get(&id).await {
Err(e) if e.to_string() == "chave nao encontrada" => refresh_and_reselect_key(),
other => handle(other),
} Prevention
- Always source ids from a fresh list() call, never from cached UI state
- Invalidate cached ids after any delete operation
- Distinguish provider name from entry id in the UI
When it happens
Trigger: Calling get (directly or via entry_with_secret, balance, use_in_app, page_images, win_list) with an id that is not in the stored list — typically a stale id after the key was deleted or the store file was reset.
Common situations: UI holding an id from before the keys file was deleted/moved; caller passing the provider name instead of the id; multiple app instances where one deleted the key.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- secao ' ' nao encontrada no board
- nao esta listado em
- o modelo não serve para remover fundo
- o Pinterest nao devolveu esse pin
- board nao encontrado
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/e05536eb7f969598.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/ai_keys.rs:243
std::fs::rename(&tmp, &p)?;
Ok(())
}
pub fn list() -> Vec<KeyView> {
let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());
load().iter().map(KeyEntry::view).collect()
}
/// Entrada completa (com segredo) para uso interno do app.
pub fn entry_with_secret(id: &str) -> anyhow::Result<KeyEntry> {
get(id)
}
fn get(id: &str) -> anyhow::Result<KeyEntry> {
load()
.into_iter()
.find(|e| e.id == id)
.ok_or_else(|| anyhow!("chave nao encontrada"))
}
fn update<F: FnOnce(&mut KeyEntry)>(id: &str, f: F) -> anyhow::Result<KeyView> {
let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());
let mut list = load();
let e = list
.iter_mut()
.find(|e| e.id == id)
.ok_or_else(|| anyhow!("chave nao encontrada"))?;
f(e);
let v = e.view();
save(&list)?;
Ok(v)
}
/// Cria ou atualiza. Chave/token vazios mantêm o valor guardado.
pub fn upsert(mut entry: KeyEntry) -> anyhow::Result<KeyView> {
let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());View on GitHub (pinned to 8600b91f42)