{"record":{"id":"cdccb71f7e22b8ed","repo":"tonhowtf/omniget","slug":"bucket-not-found-domain","errorCode":null,"errorMessage":"bucket not found: {domain}","messagePattern":"bucket not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/cookies/storage.rs","lineNumber":467,"sourceCode":"        slug: final_slug.clone(),\n        alias,\n        source_url,\n        source_label: Some(source.source_label.clone()),\n        captured_at_ms: now,\n        cookie_count: count,\n        last_used_at_ms: None,\n    });\n\n    save_registry(&registry)?;\n    Ok((final_slug, count))\n}\n\npub fn rename_account(domain: &str, slug: &str, new_alias: &str) -> anyhow::Result<()> {\n    let mut registry = load_registry();\n    let bucket = registry\n        .buckets\n        .get_mut(domain)\n        .ok_or_else(|| anyhow::anyhow!(\"bucket not found: {domain}\"))?;\n    let account = bucket\n        .accounts\n        .iter_mut()\n        .find(|a| a.slug == slug)\n        .ok_or_else(|| anyhow::anyhow!(\"account not found: {slug}\"))?;\n    account.alias = new_alias.to_string();\n    save_registry(&registry)?;\n    Ok(())\n}\n\npub fn account_path_for_consumer(domain: &str, slug: Option<&str>) -> Option<PathBuf> {\n    let slug = slug.unwrap_or(DEFAULT_SLUG);\n    let path = account_file(domain, slug);\n    if path.exists() {\n        Some(path)\n    } else {\n        None\n    }","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/cookies/storage.rs#L449-L485","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the exact domain key stored in the registry (dump load_registry output) and pass it verbatim, including any leading dot.","List available buckets/accounts first and let the user pick from real keys instead of free-typing a domain.","Normalize the domain (lowercase, strip scheme/www, keep leading-dot convention) before calling rename_account.","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.","Create the bucket first (save at least one account for the domain) before renaming."],"exampleFix":"// before\nstorage::rename_account(\"https://youtube.com\", \"work\", \"Work account\")?; // wrong key form\n\n// after\nlet domain = normalize_cookie_domain(\"https://youtube.com\"); // -> \".youtube.com\"\nif storage::list_buckets().contains(domain) {\n    storage::rename_account(&domain, \"work\", \"Work account\")?;\n}","handlingStrategy":"validation","validationCode":"// Rust\nfn normalize_cookie_domain(url_or_domain: &str) -> String {\n    let d = url_or_domain.trim_start_matches(\"https://\").trim_start_matches(\"http://\");\n    let d = d.split('/').next().unwrap_or(d);\n    let d = d.trim_start_matches(\"www.\");\n    format!(\".{}\", d.to_lowercase())\n}\n// call only if registry already lists this domain","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize domains (lowercase, no scheme/www, consistent leading dot) before registry calls","Enumerate existing buckets and let users pick rather than typing domains","Keep the registry path/config consistent so the expected buckets actually exist","Save at least one account for a domain before attempting renames"],"tags":["cookies","storage","registry","not-found","domain"],"backgroundTag":"entity-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}