tonhowtf/omniget · error
nenhuma chave selecionada
Error message
nenhuma chave selecionada
What it means
export() loads all stored key entries and filters by the requested ids; if the resulting list is empty it throws 'nenhuma chave selecionada'. This guards against exporting an empty key set — either no keys exist at all or none of the given ids match stored entries.
Solutions
- Add at least one API key in the key manager before exporting.
- Verify the ids passed to export exist (list keys first and use returned ids).
- Call export with an empty ids slice to export all keys instead of an empty selection.
- Refresh the UI list after deletions so stale ids aren't sent.
Example fix
// before export(vec!["key-123".into()], "opencode") // key already deleted // after let all = list_keys(); export(all.iter().map(|k| k.id.clone()).collect(), "opencode")
Defensive patterns
Strategy: validation
Validate before calling
// ensure selection is non-empty and ids are current
let ids: Vec<String> = selected_ids;
let stored: Vec<String> = list_keys()?.into_iter().map(|k| k.id).collect();
let valid: Vec<&String> = ids.iter().filter(|i| stored.contains(i)).collect();
if valid.is_empty() { eprintln!("no matching keys to export"); return; } Type guard
fn has_exportable(ids: &[String], keys: &[KeyEntry]) -> bool {
ids.is_empty() || keys.iter().any(|k| ids.contains(&k.id))
} Try / catch
match export(&ids, "opencode") {
Ok(json) => save(json),
Err(e) if e.to_string().contains("nenhuma chave selecionada") => {
eprintln!("vault empty or stale ids — refresh the key list");
}
Err(e) => show_error(e),
} Prevention
- Refresh id lists after any add/delete operation
- Export all keys (empty ids) when no explicit selection exists
- Validate ids against list_keys() before exporting
- Guard against empty vaults in the calling UI
When it happens
Trigger: Calling export(ids, format) with an empty vault, or with id strings that do not match any stored key entry (stale ids after deletion, typos, ids from another machine's vault).
Common situations: UI passes a selection that was deleted concurrently; caller hardcodes ids copied from a different installation; fresh install with no keys added yet.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- informe um appid, um link da loja ou marque a biblioteca…
- não achei nenhum StreamingHistory_*.json /…
- formato desconhecido
- formato desconhecido
- a legenda nao tem falas
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/61ecbc03a0ca7201.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/ai_keys.rs:519
_ => return Err(anyhow!("este provedor nao expoe saldo pela API")),
};
update(id, |e| e.balance = Some(text))
}
// ── Exportar ───────────────────────────────────────────────────────────
fn is_openai_compatible(kind: &str) -> bool {
!matches!(kind, "anthropic" | "gemini")
}
pub fn export(format: &str, ids: &[String]) -> anyhow::Result<String> {
let _g = LOCK.lock().unwrap_or_else(|e| e.into_inner());
let list: Vec<KeyEntry> = load()
.into_iter()
.filter(|e| ids.is_empty() || ids.contains(&e.id))
.collect();
if list.is_empty() {
return Err(anyhow!("nenhuma chave selecionada"));
}
let slug = |s: &str| {
s.chars()
.map(|c| {
if c.is_ascii_alphanumeric() {
c.to_ascii_lowercase()
} else {
'_'
}
})
.collect::<String>()
};
Ok(match format {
"env" => {
let mut out = String::new();
for e in &list {
let k = kind_of(&e.kind);
out.push_str(&format!("# {} ({})\n", e.name, k.name));View on GitHub (pinned to 8600b91f42)