zeroclaw-labs/zeroclaw · error

AgentScopedMemory refuses store_with_options_and_agent for…

Error message

AgentScopedMemory refuses store_with_options_and_agent for foreign agent_id; use a wrapper bound to the target agent

What it means

Agent-isolation refusal in the AgentScopedMemory wrapper: store_with_options_and_agent was called with an agent_id that differs from the agent this wrapper is bound to. The wrapper exists to make cross-writes impossible, so it rejects the store instead of delegating; the caller must construct a wrapper bound to the target agent.

Solutions

  1. Create an AgentScopedMemory wrapper bound to the target agent_id instead of storing across agents.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-memory/src/agent_scoped.rs:152 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/8f8f5c94a1cd37a7. Report an issue: GitHub.

Appendix: source

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

                options,
                Some(&self.agent_id),
            )
            .await
    }

    async fn store_with_options_and_agent(
        &self,
        key: &str,
        content: &str,
        category: MemoryCategory,
        session_id: Option<&str>,
        options: StoreOptions,
        agent_id: Option<&str>,
    ) -> Result<()> {
        if let Some(requested) = agent_id
            && requested != self.agent_id
        {
            anyhow::bail!(
                "AgentScopedMemory refuses store_with_options_and_agent for foreign agent_id; use a wrapper bound to the target agent"
            );
        }
        self.store_with_options(key, content, category, session_id, options)
            .await
    }

    async fn store_with_agent(
        &self,
        key: &str,
        content: &str,
        category: MemoryCategory,
        session_id: Option<&str>,
        namespace: Option<&str>,
        importance: Option<f64>,
        agent_id: Option<&str>,
    ) -> Result<()> {
        if let Some(requested) = agent_id

View on GitHub (pinned to 88bb9c8533)