mem0ai/mem0 · error · Error

Neptune Analytics vector search does not support case-insens

Error message

Neptune Analytics vector search does not support case-insensitive contains filters.

What it means

The Neptune Analytics filter builder supports a fixed operator set (equality, in, contains, startsWith), but icontains (case-insensitive contains) has no Neptune vector-search equivalent, so it fails fast with an explicit message rather than degrading to case-sensitive contains and returning wrong results.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts:655

            value: operand,
          },
        };
      case "contains":
        return {
          stringContains: {
            property: key,
            value: operand,
          },
        };
      case "startsWith":
        return {
          startsWith: {
            property: key,
            value: operand,
          },
        };
      case "icontains":
        throw new Error(
          "Neptune Analytics vector search does not support case-insensitive contains filters.",
        );
      default:
        throw new Error(
          `Unsupported Neptune Analytics filter operator: ${operator}`,
        );
    }
  }

  private negateVertexFilter(filter: NeptuneVertexFilter): NeptuneVertexFilter {
    if (Array.isArray(filter.andAll)) {
      return this.combineVertexFilters(
        "orAll",
        filter.andAll.map((entry: NeptuneVertexFilter) =>
          this.negateVertexFilter(entry),
        ),
      )!;
    }

View on GitHub (pinned to 001c235229)

Solutions

  1. Use contains (case-sensitive) if acceptable: { data: { contains: 'Memory' } }.
  2. Post-filter client-side: run contains, then case-insensitive match on returned payloads in JS.
  3. Store a lowercased copy of the field at insert time and contains against the lowercased query value.

Example fix

// before
store.search(q, 5, { data: { icontains: 'hello' } }); // throws

// after
const res = await store.search(q, 20, { data: { contains: 'hello' } });
const hits = res.filter(r => r.payload?.data?.toLowerCase().includes('hello'));
Defensive patterns

Strategy: fallback

Validate before calling

const UNSUPPORTED_OPS = new Set(['icontains']);
function hasUnsupportedOps(filters: any): boolean {
  return Object.values(filters ?? {}).some(
    (v) => v && typeof v === 'object' && !Array.isArray(v) && UNSUPPORTED_OPS.has(Object.keys(v)[0])
  );
}

Type guard

type NeptuneOp = { eq?: string | number; in?: (string | number)[]; contains?: string; startsWith?: string };
const isNeptuneOp = (v: unknown): v is NeptuneOp =>
  !!v && typeof v === 'object' && Object.keys(v).every((k) => ['eq', 'in', 'notIn', 'contains', 'startsWith'].includes(k));

Try / catch

try { results = await store.search(q, k, filters); }
catch (e) {
  if (e instanceof Error && e.message.includes('case-insensitive contains')) {
    // fallback: contains search + client-side case-insensitive refinement
    const wide = await store.search(q, k * 4, replaceOp(filters, 'icontains', 'contains'));
    results = wide.filter((r) => JSON.stringify(r.payload).toLowerCase().includes(needle.toLowerCase()));
  } else throw e;
}

Prevention

When it happens

Trigger: Advanced filter objects like { data: { icontains: 'memory' } } or { key: 'data', operator: 'icontains', value: ... } on the neptune-analytics provider; porting filter logic from SQL/SQLAlchemy-based stores (where icontains is common) or from Mem0's Python providers that support it.

Common situations: Cross-provider filter code; search UIs offering case-insensitive substring search; LLM filter generation picking icontains from a generic operator vocabulary.

Related errors


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