zeroclaw-labs/zeroclaw · error

AgentScopedMemory refuses store_with_agent for foreign agent

Error message

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

What it means

Error "AgentScopedMemory refuses store_with_agent for foreign agent_id; use a wrapper bound to the target agent" thrown in zeroclaw-labs/zeroclaw.

Source

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

        namespace: Option<&str>,
        importance: Option<f64>,
        agent_id: Option<&str>,
    ) -> Result<()> {
        if let Some(requested) = agent_id
            && requested != 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!({
                        "bound_agent": self.agent_id,
                        "requested_agent": requested,
                        "key": key,
                    })),
                "store_with_agent refused: foreign agent_id"
            );
            anyhow::bail!(
                "AgentScopedMemory refuses store_with_agent for foreign agent_id; use a wrapper bound to the target agent"
            );
        }
        self.inner
            .store_with_agent(
                key,
                content,
                category,
                session_id,
                namespace,
                importance,
                Some(&self.agent_id),
            )
            .await
    }

    async fn recall(
        &self,

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Create an AgentScopedMemory wrapper bound to the target agent_id instead of calling store_with_agent for a foreign agent.

When it happens

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