mem0ai/mem0 · critical · Error

RediSearch module is not loaded. Please ensure Redis Stack i

Error message

RediSearch module is not loaded. Please ensure Redis Stack is properly installed and running.

What it means

The Redis vector store needs the RediSearch module (FT.* commands) for index creation and vector queries. During initialization it runs MODULE LIST and checks for a module named 'search' or 'searchlight'; plain Redis (without RediSearch) does not have it, so the store refuses to continue with this error.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/redis.ts:309

          return name === "search" || name === "searchlight";
        }
        // Fallback: legacy flat array format [key, value, key, value, ...]
        if (Array.isArray(mod)) {
          const moduleMap = new Map();
          for (let i = 0; i < mod.length; i += 2) {
            moduleMap.set(mod[i], mod[i + 1]);
          }
          const name = moduleMap.get("name");
          return (
            name?.toLowerCase() === "search" ||
            name?.toLowerCase() === "searchlight"
          );
        }
        return false;
      });

      if (!hasSearch) {
        throw new Error(
          "RediSearch module is not loaded. Please ensure Redis Stack is properly installed and running.",
        );
      }

      // Create index with retries
      let retries = 0;
      const maxRetries = 3;
      while (retries < maxRetries) {
        try {
          await this.createIndex();
          console.log("Redis index created successfully");
          break;
        } catch (error) {
          console.error(
            `Error creating index (attempt ${retries + 1}/${maxRetries}):`,
            error,
          );
          retries++;

View on GitHub (pinned to 001c235229)

Solutions

  1. Run Redis Stack: docker run -p 6379:6379 redis/redis-stack-server:latest
  2. For managed Redis, enable the RediSearch module (Redis Cloud with search capability, ElastiCache with search enabled, etc.)
  3. Verify the module is loaded: redis-cli MODULE LIST | grep -i search
  4. Confirm you are connecting to the right host/port — sometimes the app hits a different, plain Redis instance

Example fix

# before
redis-server  # plain Redis, no search module

# after
docker run -d -p 6379:6379 redis/redis-stack-server:latest
Defensive patterns

Strategy: validation

Validate before calling

import { createClient } from 'redis';
async function redisHasSearch(url: string): Promise<boolean> {
  const client = createClient({ url });
  await client.connect();
  try {
    const mods: any[] = await client.sendCommand(['MODULE', 'LIST']) as any[];
    for (let i = 0; i < mods.length; i += 2) {
      const m = mods[i] as any[];
      const nameIdx = m.findIndex(x => Buffer.isBuffer(x) && x.toString() === 'name');
      if (nameIdx !== -1 && m[nameIdx + 1]) return true;
    }
    return false;
  } finally { await client.disconnect(); }
}
if (!(await redisHasSearch(redisUrl))) throw new Error('Need Redis Stack (RediSearch module)');

Type guard

const isRedisStackUrl = (u: string): boolean => true; // URL alone cannot prove it; probe MODULE LIST instead

Try / catch

try { const vs = new Redis(redisConfig); await vs.createCol(...); } catch (e) { if (e instanceof Error && e.message.includes('RediSearch')) { /* switch to Redis Stack endpoint, then retry init */ } throw e; }

Prevention

When it happens

Trigger: Pointing the Redis store at a vanilla redis-server or a minimal Redis Docker image instead of Redis Stack (redis/redis-stack-server); connecting to a managed Redis that lacks the search module; port pointing to a different Redis instance.

Common situations: Local dev using 'redis' image instead of 'redis/redis-stack'; cloud-managed Redis offerings where RediSearch is a paid tier option; infra changes replaced Redis Stack with plain Redis; custom Redis builds compiled without the module.

Related errors


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