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

memory clear is unsupported for append-only backend '{$backe

Error message

memory clear is unsupported for append-only backend '{$backend}'; switch to a deletable backend (sqlite, lucid, or postgres)

What it means

`zeroclaw memory clear` only works on backends that support deletion. Markdown and Qdrant are treated as append-only (classify_memory_backend returns Markdown or Qdrant), so handle_clear bails with a message listing the deletable alternatives (sqlite, lucid, postgres) before doing anything.

Source

Thrown at src/memory/cli.rs:326

    {
        format!(
            "memory clear is unsupported for append-only backend '{backend}'; switch to a deletable backend (sqlite, lucid, or postgres)"
        )
    }
}

async fn handle_clear(
    config: &Config,
    key: Option<String>,
    category: Option<String>,
    yes: bool,
) -> Result<()> {
    let backend = backend_kind_from_dotted(&config.memory.backend);
    if matches!(
        classify_memory_backend(&backend),
        MemoryBackendKind::Markdown | MemoryBackendKind::Qdrant
    ) {
        bail!(unsupported_clear_backend_message(&backend));
    }
    let mem = create_cli_memory(config)?;

    // Single-key deletion (exact or prefix match).
    if let Some(key) = key {
        return handle_clear_key(&*mem, &key, yes).await;
    }

    // Batch deletion by category (or all).
    let cat = category.as_deref().map(parse_category);
    let entries = mem.list(cat.as_ref(), None).await?;

    if entries.is_empty() {
        println!("{}", mt("cli-memory-none-to-clear", "No entries to clear."));
        return Ok(());
    }

    let scope = category.as_deref().unwrap_or("all categories");

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Switch memory.backend to a deletable backend (sqlite, lucid, or postgres) and re-run clear
  2. For markdown, delete/prune the memory files manually (they are plain files on disk)
  3. For qdrant, purge the collection with qdrant's own tooling if you truly need a wipe
  4. Keep a deletable backend if your workflow regularly calls memory clear

Example fix

# before
[memory]
backend = "markdown"
zeroclaw memory clear   # -> unsupported

# after
[memory]
backend = "sqlite"
zeroclaw memory clear
Defensive patterns

Strategy: validation

Validate before calling

// Same classification the command uses, checked before offering 'clear':
use MemoryBackendKind::*;
match classify_memory_backend(&backend_kind_from_dotted(&config.memory.backend)) {
    Markdown | Qdrant => { /* hide/disable the clear action in your UI */ }
    _ => { /* safe to run memory clear */ }
}

Type guard

fn supports_clear(kind: MemoryBackendKind) -> bool {
    !matches!(kind, MemoryBackendKind::Markdown | MemoryBackendKind::Qdrant)
}

Try / catch

// Catch the bail and route to guidance: for Markdown offer file deletion,
// for Qdrant offer collection purge — do not retry clear on the same backend.

Prevention

When it happens

Trigger: Running `zeroclaw memory clear` (with or without a --key) while memory.backend is "markdown" or "qdrant". The backend-kind check runs before create_cli_memory, so no store is even opened.

Common situations: Using the markdown backend for human-readable memory files and expecting clear to prune them; a qdrant-only setup (vector store without a deletable metadata store); following a tutorial written for sqlite while running markdown.

Related errors


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