tinyhumansai/openhuman · error · anyhow::Error

delete failed after removing {deleted} facets: {e:#}

Error message

delete failed after removing {deleted} facets: {e:#}

What it means

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.

Source

Thrown at src/openhuman/agent/learning/cache.rs:181

/// matters: the next turn keeps reading material the user asked to forget.
/// `Ok(false)` from a delete is different and stays silent — the row was
/// already gone, which is the requested end state.
pub async fn reset_non_pinned(cache: &FacetCache) -> anyhow::Result<(usize, usize)> {
    let all = cache.list_all().await?;
    let pinned_preserved = all
        .iter()
        .filter(|f| f.user_state == UserState::Pinned)
        .count();

    let mut deleted = 0usize;
    for facet in &all {
        if facet.user_state == UserState::Pinned {
            continue;
        }
        if cache
            .delete(&facet.key)
            .await
            .map_err(|e| anyhow::anyhow!("delete failed after removing {deleted} facets: {e:#}"))?
        {
            deleted += 1;
        }
    }
    Ok((deleted, pinned_preserved))
}

/// Build a full key from a class and a suffix (e.g. `(Style, "verbosity")` → `"style/verbosity"`).
pub fn key_with_class(class: FacetClass, suffix: &str) -> String {
    format!("{}/{suffix}", class_prefix(class))
}

/// Return the canonical key prefix for a [`FacetClass`].
pub fn class_prefix(class: FacetClass) -> &'static str {
    match class {
        FacetClass::Style => "style",
        FacetClass::Identity => "identity",
        FacetClass::Tooling => "tooling",

View on GitHub (pinned to 7491200858)

Solutions

  1. Retry the reset operation — already-deleted facets return Ok(false) and are skipped
  2. Check the underlying store error (memory module health, disk/DB availability) if the failure persists
  3. Verify afterwards with cache stats that only pinned facets remain
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/openhuman/agent/learning/cache.rs:181 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/9d64a49a8faf9c90. Report an issue: GitHub.