zeroclaw-labs/zeroclaw · error

AgentScopedMemory refuses cross-agent forget_for_agent: boun

Error message

AgentScopedMemory refuses cross-agent forget_for_agent: bound agent and target agent differ

What it means

Error "AgentScopedMemory refuses cross-agent forget_for_agent: bound agent and target agent differ" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-memory/src/agent_scoped.rs:340

        }
    }

    async fn forget_for_agent(&self, key: &str, agent_id: &str) -> Result<bool> {
        // Only the bound agent can delete its own row through the
        // wrapper. Allowlist grants recall, never delete.
        if agent_id != self.agent_id {
            ::zeroclaw_log::record!(
                WARN,
                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)
                    .with_attrs(::serde_json::json!({
                        "key": key,
                        "row_agent": agent_id,
                        "bound_agent": self.agent_id,
                    })),
                "forget_for_agent refused: cross-agent delete through wrapper"
            );
            anyhow::bail!(
                "AgentScopedMemory refuses cross-agent forget_for_agent: bound agent and target agent differ"
            );
        }
        self.inner.forget_for_agent(key, agent_id).await
    }

    async fn count(&self) -> Result<usize> {
        // Scope to the bound + allowlisted agents so a wrapper-using
        // caller does not see the install-wide row total.
        let entries = self.inner.list(None, None).await?;
        Ok(entries
            .into_iter()
            .filter(|e| {
                e.agent_id
                    .as_deref()
                    .is_some_and(|aid| self.allowed_agent_ids.contains(aid))
            })
            .count())

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Call forget_for_agent only for the bound agent; use an admin handle for cross-agent operations.

When it happens

Trigger: Thrown at crates/zeroclaw-memory/src/agent_scoped.rs:340 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/89ab361164385fd8. Report an issue: GitHub.