tonhowtf/omniget · error

bucket not found

Error message

bucket not found: {domain}

What it means

rename_account loads the cookie account registry and looks up the bucket keyed by the cookie domain; if no bucket exists for that domain it fails with 'bucket not found: {domain}'. A bucket is only present for domains that have had accounts saved before, so the domain must exist in the registry.

Solutions

  1. Confirm the exact domain key stored in the registry (dump load_registry output) and pass it verbatim, including any leading dot.
  2. List available buckets/accounts first and let the user pick from real keys instead of free-typing a domain.
  3. Normalize the domain (lowercase, strip scheme/www, keep leading-dot convention) before calling rename_account.
  4. If the bucket genuinely should exist, check the registry file path/permissions — it may have been deleted or a different storage dir is in use.
  5. Create the bucket first (save at least one account for the domain) before renaming.

Example fix

// before
storage::rename_account("https://youtube.com", "work", "Work account")?; // wrong key form

// after
let domain = normalize_cookie_domain("https://youtube.com"); // -> ".youtube.com"
if storage::list_buckets().contains(domain) {
    storage::rename_account(&domain, "work", "Work account")?;
}
Defensive patterns

Strategy: validation

Validate before calling

// Rust
fn normalize_cookie_domain(url_or_domain: &str) -> String {
    let d = url_or_domain.trim_start_matches("https://").trim_start_matches("http://");
    let d = d.split('/').next().unwrap_or(d);
    let d = d.trim_start_matches("www.");
    format!(".{}", d.to_lowercase())
}
// call only if registry already lists this domain

Prevention

When it happens

Trigger: Calling rename_account(domain, slug, new_alias) with a domain string that has no entry in the registry: never-saved domain, domain spelled differently than stored (e.g. '.example.com' vs 'example.com', leading dot or scheme/leading 'www' mismatch), or registry file reset/deleted.

Common situations: Frontend passes the URL host while the registry stores the cookie domain with a leading dot; user renames an account after the registry was wiped or before any cookies for that site were saved; case mismatch ('.YouTube.com' vs '.youtube.com'); rename called with a placeholder/empty domain.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/cdccb71f7e22b8ed. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/cookies/storage.rs:467

        slug: final_slug.clone(),
        alias,
        source_url,
        source_label: Some(source.source_label.clone()),
        captured_at_ms: now,
        cookie_count: count,
        last_used_at_ms: None,
    });

    save_registry(&registry)?;
    Ok((final_slug, count))
}

pub fn rename_account(domain: &str, slug: &str, new_alias: &str) -> anyhow::Result<()> {
    let mut registry = load_registry();
    let bucket = registry
        .buckets
        .get_mut(domain)
        .ok_or_else(|| anyhow::anyhow!("bucket not found: {domain}"))?;
    let account = bucket
        .accounts
        .iter_mut()
        .find(|a| a.slug == slug)
        .ok_or_else(|| anyhow::anyhow!("account not found: {slug}"))?;
    account.alias = new_alias.to_string();
    save_registry(&registry)?;
    Ok(())
}

pub fn account_path_for_consumer(domain: &str, slug: Option<&str>) -> Option<PathBuf> {
    let slug = slug.unwrap_or(DEFAULT_SLUG);
    let path = account_file(domain, slug);
    if path.exists() {
        Some(path)
    } else {
        None
    }

View on GitHub (pinned to 8600b91f42)