zeroclaw-labs/zeroclaw · critical · anyhow::Error

memory backend '{}' does not support agent-attributed StoreO

Error message

memory backend '{}' does not support agent-attributed StoreOptions kind/pinned/tenant_id; use a backend that overrides store_with_options_and_agent

What it means

tool_linker() lazily builds, once per process via OnceLock, the wasmtime component Linker every tool plugin instantiates against: WASI Preview 2 imports plus the generated zeroclaw tool-world bindings (base_linker → ToolPlugin::add_to_linker). add_to_linker fails when import names collide or host signatures do not match what the engine expects — practically a version or generation mismatch between wasmtime, wasmtime-wasi, and the checked-in generated bindings. The expect fires on the first create_plugin() call and disables plugin tooling for the whole process.

Source

Thrown at crates/zeroclaw-api/src/memory_traits.rs:594

    /// Store a memory entry with full metadata and an explicit agent UUID.
    ///
    /// The compatibility default preserves agent attribution through the
    /// established `store_with_agent` path for namespace and importance only.
    /// Backends that persist the full `StoreOptions` surface override this
    /// method so wrappers do not have to choose between attribution and typed
    /// metadata.
    async fn store_with_options_and_agent(
        &self,
        key: &str,
        content: &str,
        category: MemoryCategory,
        session_id: Option<&str>,
        options: StoreOptions,
        agent_id: Option<&str>,
    ) -> anyhow::Result<()> {
        if options.requires_full_options_storage() {
            anyhow::bail!(
                "memory backend '{}' does not support agent-attributed StoreOptions kind/pinned/tenant_id; use a backend that overrides store_with_options_and_agent",
                self.name()
            );
        }
        self.store_with_agent(
            key,
            content,
            category,
            session_id,
            options.namespace.as_deref(),
            options.importance,
            agent_id,
        )
        .await
    }

    /// Store a memory entry attributed to an explicit agent UUID.
    /// Every backend must implement this explicitly so the agent_id

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Pin wasmtime, wasmtime-wasi, and wasmtime-wasi-http to one identical version in Cargo.toml and run cargo update.
  2. cargo clean and rebuild so generated bindings and engine versions agree.
  3. Regenerate the component bindings from wit/v0 with the toolchain version the host crates expect.
  4. If maintaining a fork, diff add_wasi/add_wasi_http usage against any manual linker definitions for duplicate imports.
  5. If a stock checkout fails, report upstream with the exact wasmtime/wasi versions in Cargo.lock.

Example fix

// before
static LINKER: OnceLock<Linker<PluginState>> = OnceLock::new();
LINKER.get_or_init(|| base_linker().expect("tool linker"))

// after — keep the Result so callers can degrade instead of panicking on first use
static LINKER: OnceLock<anyhow::Result<Linker<PluginState>>> = OnceLock::new();
LINKER.get_or_init(base_linker).as_ref()
    .map_err(|e| anyhow::anyhow!("tool linker init failed: {e:#}"))
Defensive patterns

Strategy: fallback

Try / catch

// First plugin creation panics if the linker cannot build; contain it:
let probe = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
    futures::executor::block_on(
        zeroclaw_plugins::runtime::create_plugin(&wasm_path, &scope, limits),
    )
}));
if probe.is_err() {
    disable_plugins_and_log(); // degrade to native tools, keep the agent alive
}

Prevention

When it happens

Trigger: The first tool-plugin load after startup when wasmtime/wasmtime-wasi versions are skewed relative to the generated component bindings, or a fork defines overlapping imports on the same linker.

Common situations: Cargo updated wasmtime patch versions inconsistently; wasmtime-wasi or the bindings pinned to an older release; component bindings regenerated from a newer wit/v0 than the host crates support; local forks adding manual imports that clash with add_wasi.

Related errors


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