{"record":{"id":"600bf7279f73e722","repo":"tonhowtf/omniget","slug":"account-not-found-slug","errorCode":null,"errorMessage":"account not found: {slug}","messagePattern":"account not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/cookies/storage.rs","lineNumber":472,"sourceCode":"        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    }\n}\n\npub fn touch_last_used(domain: &str, slug: &str) {\n    let mut registry = load_registry();\n    let now = current_unix_ms();","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/cookies/storage.rs#L454-L490","documentation":"After the bucket lookup succeeds, rename_account searches bucket.accounts for an entry whose slug matches; a miss fails with 'account not found: {slug}'. The bucket exists but contains no account with that slug identifier.","triggerScenarios":"Calling rename_account(domain, slug, new_alias) where the domain bucket exists but the slug does not: account was deleted earlier, slug is case-mismatched or misspelled, slug belongs to a different domain's bucket, or the caller passed an alias/display name instead of the stored slug.","commonSituations":"UI caches account slugs that were deleted in another window; developer confuses alias (rename target) with slug (lookup key); slug from a stale list after re-importing cookies re-generated slugs; multiple domains share similar slugs and the wrong domain was used.","solutions":["Fetch the current account list for the domain (e.g. via the registry/bucket listing) and verify the slug exists before renaming.","Check slug spelling/case and that it belongs to the same domain passed as the first argument.","Refresh any cached account lists after deletions so stale slugs aren't used.","If the intended fix is renaming by display name, look up the slug by alias first, then call rename_account with the slug."],"exampleFix":"// before\nstorage::rename_account(\".youtube.com\", \"work-acount\", \"Work\"); // typo slug\n\n// after\nlet bucket = storage::get_bucket(\".youtube.com\")?;\nlet slug = bucket.accounts.iter()\n    .find(|a| a.slug == \"work-account\" || a.alias == \"Work\")\n    .map(|a| a.slug.clone())\n    .ok_or_else(|| anyhow::anyhow!(\"account not found in .youtube.com bucket\"))?;\nstorage::rename_account(\".youtube.com\", &slug, \"Work\")?;","handlingStrategy":"validation","validationCode":"// Rust\nlet bucket = cookie_storage::load_registry().buckets.get(domain)\n    .ok_or_else(|| anyhow::anyhow!(\"bucket not found: {domain}\"))?;\nif !bucket.accounts.iter().any(|a| a.slug == slug) {\n    let known: Vec<_> = bucket.accounts.iter().map(|a| a.slug.clone()).collect();\n    anyhow::bail!(\"slug '{slug}' not in {domain}; known: {:?}\", known);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always look up accounts by stored slug, never by alias or display name","Refresh cached account lists after deletions or re-imports","Show the user a picker of existing slugs instead of free-text input","Verify slug-to-domain pairing when multiple cookie domains are in play"],"tags":["cookies","storage","registry","not-found","slug"],"backgroundTag":"record-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"}