{"record":{"id":"7d6ab74a45c7336c","repo":"mem0ai/mem0","slug":"redisearch-module-is-not-loaded-please-ensure-red","errorCode":null,"errorMessage":"RediSearch module is not loaded. Please ensure Redis Stack is properly installed and running.","messagePattern":"RediSearch module is not loaded\\. Please ensure Redis Stack is properly installed and running\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"mem0-ts/src/oss/src/vector_stores/redis.ts","lineNumber":309,"sourceCode":"          return name === \"search\" || name === \"searchlight\";\n        }\n        // Fallback: legacy flat array format [key, value, key, value, ...]\n        if (Array.isArray(mod)) {\n          const moduleMap = new Map();\n          for (let i = 0; i < mod.length; i += 2) {\n            moduleMap.set(mod[i], mod[i + 1]);\n          }\n          const name = moduleMap.get(\"name\");\n          return (\n            name?.toLowerCase() === \"search\" ||\n            name?.toLowerCase() === \"searchlight\"\n          );\n        }\n        return false;\n      });\n\n      if (!hasSearch) {\n        throw new Error(\n          \"RediSearch module is not loaded. Please ensure Redis Stack is properly installed and running.\",\n        );\n      }\n\n      // Create index with retries\n      let retries = 0;\n      const maxRetries = 3;\n      while (retries < maxRetries) {\n        try {\n          await this.createIndex();\n          console.log(\"Redis index created successfully\");\n          break;\n        } catch (error) {\n          console.error(\n            `Error creating index (attempt ${retries + 1}/${maxRetries}):`,\n            error,\n          );\n          retries++;","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/redis.ts#L291-L327","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run Redis Stack: docker run -p 6379:6379 redis/redis-stack-server:latest","For managed Redis, enable the RediSearch module (Redis Cloud with search capability, ElastiCache with search enabled, etc.)","Verify the module is loaded: redis-cli MODULE LIST | grep -i search","Confirm you are connecting to the right host/port — sometimes the app hits a different, plain Redis instance"],"exampleFix":"# before\nredis-server  # plain Redis, no search module\n\n# after\ndocker run -d -p 6379:6379 redis/redis-stack-server:latest","handlingStrategy":"validation","validationCode":"import { createClient } from 'redis';\nasync function redisHasSearch(url: string): Promise<boolean> {\n  const client = createClient({ url });\n  await client.connect();\n  try {\n    const mods: any[] = await client.sendCommand(['MODULE', 'LIST']) as any[];\n    for (let i = 0; i < mods.length; i += 2) {\n      const m = mods[i] as any[];\n      const nameIdx = m.findIndex(x => Buffer.isBuffer(x) && x.toString() === 'name');\n      if (nameIdx !== -1 && m[nameIdx + 1]) return true;\n    }\n    return false;\n  } finally { await client.disconnect(); }\n}\nif (!(await redisHasSearch(redisUrl))) throw new Error('Need Redis Stack (RediSearch module)');","typeGuard":"const isRedisStackUrl = (u: string): boolean => true; // URL alone cannot prove it; probe MODULE LIST instead","tryCatchPattern":"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; }","preventionTips":["Standardize on redis/redis-stack-server images in dev and staging","Add a container healthcheck that runs redis-cli FT._LIST","For managed Redis, verify the plan includes search before writing code"],"tags":["redis","redisearch","module","infrastructure","docker","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}