mem0ai/mem0 · error · Error

NOT filter value must be a list of filter dicts, got ${typeo

Error message

NOT filter value must be a list of filter dicts, got ${typeof value}

What it means

filterVector() requires a 'NOT' key to be an array of filter objects; every entry must fail to match for the vector to pass. A non-array value throws before evaluation, mirroring the AND/OR guards so all three combinators fail consistently.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/cassandra.ts:568

        ) {
          return false;
        }
      } else if (key === "OR") {
        if (!Array.isArray(value)) {
          throw new Error(
            `OR filter value must be a list of filter dicts, got ${typeof value}`,
          );
        }
        if (
          !value.some((entry: SearchFilters) =>
            this.filterVector(vector, entry),
          )
        ) {
          return false;
        }
      } else if (key === "NOT") {
        if (!Array.isArray(value)) {
          throw new Error(
            `NOT filter value must be a list of filter dicts, got ${typeof value}`,
          );
        }
        if (
          !value.every(
            (entry: SearchFilters) => !this.filterVector(vector, entry),
          )
        ) {
          return false;
        }
      } else if (!this.matchFieldCondition(vector.payload, key, value)) {
        return false;
      }
    }

    return true;
  }

View on GitHub (pinned to 001c235229)

Solutions

  1. Wrap the NOT value in an array of filter dicts: { NOT: [{ user_id: 'x' }] }
  2. For excluding multiple conditions, list each as its own entry: { NOT: [{ status: 'draft' }, { deleted: true }] }

Example fix

// before
memory.search('q', { filters: { NOT: { user_id: 'x' } } });

// after
memory.search('q', { filters: { NOT: [{ user_id: 'x' }] } });
Defensive patterns

Strategy: type-guard

Validate before calling

if (filters.NOT && !Array.isArray(filters.NOT)) throw new Error('NOT must be an array of filter dicts');

Type guard

const isFilterDictArray = (v: unknown): v is Record<string, any>[] =>
  Array.isArray(v) && v.every((e) => e !== null && typeof e === 'object' && !Array.isArray(e));

Prevention

When it happens

Trigger: Passing filters like { NOT: { user_id: 'x' } } (single dict) or { NOT: 'x' } to search/list/getAll on the Cassandra store.

Common situations: Expecting NOT to take a single exclusion object (as in some other APIs); converting from Qdrant's must_not style where the payload is one condition object.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/29eb46a36c4ab0cb. Report an issue: GitHub.