{"record":{"id":"d0db61dd47e100c0","repo":"zeroclaw-labs/zeroclaw","slug":"agentscopedmemory-refuses-store-with-agent-for-for","errorCode":null,"errorMessage":"AgentScopedMemory refuses store_with_agent for foreign agent_id; use a wrapper bound to the target agent","messagePattern":"AgentScopedMemory refuses store_with_agent for foreign agent_id; use a wrapper bound to the target agent","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-memory/src/agent_scoped.rs","lineNumber":184,"sourceCode":"        namespace: Option<&str>,\n        importance: Option<f64>,\n        agent_id: Option<&str>,\n    ) -> Result<()> {\n        if let Some(requested) = agent_id\n            && requested != self.agent_id\n        {\n            ::zeroclaw_log::record!(\n                WARN,\n                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)\n                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                    .with_attrs(::serde_json::json!({\n                        \"bound_agent\": self.agent_id,\n                        \"requested_agent\": requested,\n                        \"key\": key,\n                    })),\n                \"store_with_agent refused: foreign agent_id\"\n            );\n            anyhow::bail!(\n                \"AgentScopedMemory refuses store_with_agent for foreign agent_id; use a wrapper bound to the target agent\"\n            );\n        }\n        self.inner\n            .store_with_agent(\n                key,\n                content,\n                category,\n                session_id,\n                namespace,\n                importance,\n                Some(&self.agent_id),\n            )\n            .await\n    }\n\n    async fn recall(\n        &self,","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-memory/src/agent_scoped.rs#L166-L202","documentation":"Error \"AgentScopedMemory refuses store_with_agent for foreign agent_id; use a wrapper bound to the target agent\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-memory/src/agent_scoped.rs:184 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create an AgentScopedMemory wrapper bound to the target agent_id instead of calling store_with_agent for a foreign agent."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}