{"record":{"id":"9d64a49a8faf9c90","repo":"tinyhumansai/openhuman","slug":"delete-failed-after-removing-deleted-facets-e","errorCode":null,"errorMessage":"delete failed after removing {deleted} facets: {e:#}","messagePattern":"delete failed after removing (.+?) facets: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/learning/cache.rs","lineNumber":181,"sourceCode":"/// matters: the next turn keeps reading material the user asked to forget.\n/// `Ok(false)` from a delete is different and stays silent — the row was\n/// already gone, which is the requested end state.\npub async fn reset_non_pinned(cache: &FacetCache) -> anyhow::Result<(usize, usize)> {\n    let all = cache.list_all().await?;\n    let pinned_preserved = all\n        .iter()\n        .filter(|f| f.user_state == UserState::Pinned)\n        .count();\n\n    let mut deleted = 0usize;\n    for facet in &all {\n        if facet.user_state == UserState::Pinned {\n            continue;\n        }\n        if cache\n            .delete(&facet.key)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"delete failed after removing {deleted} facets: {e:#}\"))?\n        {\n            deleted += 1;\n        }\n    }\n    Ok((deleted, pinned_preserved))\n}\n\n/// Build a full key from a class and a suffix (e.g. `(Style, \"verbosity\")` → `\"style/verbosity\"`).\npub fn key_with_class(class: FacetClass, suffix: &str) -> String {\n    format!(\"{}/{suffix}\", class_prefix(class))\n}\n\n/// Return the canonical key prefix for a [`FacetClass`].\npub fn class_prefix(class: FacetClass) -> &'static str {\n    match class {\n        FacetClass::Style => \"style\",\n        FacetClass::Identity => \"identity\",\n        FacetClass::Tooling => \"tooling\",","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/learning/cache.rs#L163-L199","documentation":"reset_non_pinned was deleting non-pinned facets and one of the deletes failed partway through (after N successful deletions). This is a partial-completion error: some facets are already gone, so retrying is safe — the delete loop skips already-deleted rows. Failing matters because stale facets would keep influencing turns after the user asked to forget them.","triggerScenarios":"Thrown at src/openhuman/agent/learning/cache.rs:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the reset operation — already-deleted facets return Ok(false) and are skipped","Check the underlying store error (memory module health, disk/DB availability) if the failure persists","Verify afterwards with cache stats that only pinned facets remain"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}