zeroclaw-labs/zeroclaw · error

memory backend 'postgres' requires a `[storage.postgres.<ali

Error message

memory backend 'postgres' requires a `[storage.postgres.<alias>]` entry referenced by `memory.backend = "postgres.<alias>"`

What it means

The postgres mirror of the qdrant alias check: the backend classified as postgres, but the resolved active storage is not an ActiveStorage::Postgres entry, so the [storage.postgres.<alias>] section with connection settings was never found. The factory refuses to guess connection parameters and names the required TOML shape.

Source

Thrown at crates/zeroclaw-memory/src/lib.rs:719

            INFO,
            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
            &format!(
                "📦 Qdrant memory backend configured (url: {}, collection: {})",
                url, collection
            )
        );
        return wrap_scanned_and_audit(
            QdrantMemory::new_lazy("qdrant", &url, &collection, qdrant_api_key, embedder),
            &config.policy,
            workspace_dir,
            config.audit_enabled,
        );
    }

    if matches!(backend_kind, MemoryBackendKind::Postgres) {
        let pg_cfg = match active_storage {
            ActiveStorage::Postgres(p) => p,
            _ => anyhow::bail!(
                "memory backend 'postgres' requires a `[storage.postgres.<alias>]` entry \
                 referenced by `memory.backend = \"postgres.<alias>\"`"
            ),
        };
        #[cfg(feature = "memory-postgres")]
        {
            return wrap_scanned_and_audit(
                build_postgres_memory(pg_cfg)?,
                &config.policy,
                workspace_dir,
                config.audit_enabled,
            );
        }
        #[cfg(not(feature = "memory-postgres"))]
        {
            return build_postgres_memory(pg_cfg);
        }
    }

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Add `[storage.postgres.<alias>]` with the connection settings (host/database/credentials per the storage config schema) and align `memory.backend = "postgres.<alias>"`.
  2. Fix the alias mismatch between memory.backend's suffix and the TOML section name.
  3. Confirm the section is under the postgres family, not another storage family.

Example fix

# before
[memory]
backend = "postgres.main"

# after
[memory]
backend = "postgres.main"

[storage.postgres.main]
database_url = "postgres://user:pass@localhost/zeroclaw"
Defensive patterns

Strategy: validation

Validate before calling

let backend = backend_kind_from_dotted(&config.memory.backend);
if backend == "postgres"
    && !matches!(config.resolve_active_storage(), ActiveStorage::Postgres(_))
{
    anyhow::bail!(
        "memory.backend = {:?} has no matching [storage.postgres.<alias>] section",
        config.memory.backend
    );
}

Prevention

When it happens

Trigger: `memory.backend = "postgres.main"` while `[storage.postgres.main]` does not exist, is typo'd, or sits under another family ([storage.qdrant.main]). Note this check runs before the feature check, so it can also fire on builds lacking memory-postgres when the section is absent.

Common situations: Renaming storage aliases without updating memory.backend; config overlays stripping the [storage.postgres.*] section in lower environments; migrating a sqlite deployment to postgres by editing only the memory.backend line.

Related errors


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