{"record":{"id":"c1c31799788ab4f1","repo":"mem0ai/mem0","slug":"valkey-search-module-is-not-available-please-ensu","errorCode":null,"errorMessage":"Valkey search module is not available. Please ensure Valkey is running with the search module enabled.","messagePattern":"Valkey search module is not available\\. Please ensure Valkey is running with the search module enabled\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"mem0-ts/src/oss/src/vector_stores/valkey.ts","lineNumber":256,"sourceCode":"      \"memory\",\n      \"TEXT\",\n      \"metadata\",\n      \"TAG\",\n      \"created_at\",\n      \"NUMERIC\",\n      \"updated_at\",\n      \"NUMERIC\",\n      ...vectorConfig,\n    ];\n  }\n\n  private async ensureSearchModule(): Promise<void> {\n    try {\n      await this.client.call(\"FT._LIST\");\n    } catch (error: any) {\n      const message = String(error?.message ?? error).toLowerCase();\n      if (message.includes(\"unknown command\")) {\n        throw new Error(\n          \"Valkey search module is not available. Please ensure Valkey is running with the search module enabled.\",\n        );\n      }\n      throw error;\n    }\n  }\n\n  private async createIndex(): Promise<void> {\n    await this.ensureSearchModule();\n\n    try {\n      await this.client.call(\"FT.INFO\", this.collectionName);\n      return;\n    } catch (error: any) {\n      const message = String(error?.message ?? error).toLowerCase();\n      if (\n        !message.includes(\"not found\") &&\n        !message.includes(\"unknown index\")","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/valkey.ts#L238-L274","documentation":"The Valkey store verifies the RediSearch-compatible search module is loaded by calling FT._LIST during index creation. If the server replies 'unknown command', the search module is not loaded and this error is thrown: plain Valkey/Redis without the search module cannot serve vector queries. Other errors (auth, connection) are rethrown unchanged.","triggerScenarios":"Connecting to a stock Redis or Valkey server compiled/launched without the search module (no --loadmodule redisearch.so / search-module build); managed Redis offerings without RediSearch; targeting the wrong port that happens to run plain Redis.","commonSituations":"Using plain redis:latest Docker image instead of a search-enabled image (e.g. valkey/valkey-search or redis/redis-stack-server); self-compiled Valkey without the module; managed Redis (ElastiCache non-cluster with search disabled) that lacks FT commands.","solutions":["Run a search-enabled server: use redis/redis-stack-server or a Valkey image/build with the search module, loading redisearch.so in the config.","If self-hosting Valkey, build/install the search module and add --loadmodule /path/to/search.so to the server command.","Use Redis Cloud / a provider plan that includes RediSearch (FT.* commands).","Verify with redis-cli FT._LIST — it must list indexes, not return 'unknown command'."],"exampleFix":"# before\ndocker run -p 6379:6379 redis:latest\n\n# after\ndocker run -p 6379:6379 redis/redis-stack-server:latest","handlingStrategy":"validation","validationCode":"// pre-flight: confirm search module before constructing Memory\nimport { createClient } from 'redis';\nconst redis = createClient({ url: valkeyUrl });\nawait redis.connect();\ntry { await redis.sendCommand(['FT._LIST']); } catch { throw new Error('Server lacks the search module — use redis-stack or a search-enabled Valkey build'); } finally { await redis.disconnect(); }","typeGuard":null,"tryCatchPattern":"try { await memory.add(text); } catch (e) { if (e instanceof Error && e.message.includes('search module')) { /* switch connection string to a search-enabled server */ } else throw e; }","preventionTips":["Use redis/redis-stack-server or a Valkey search build in docker-compose from day one","Add FT._LIST to deployment smoke tests","Pin the search-enabled image explicitly"],"tags":["valkey","redis","modules","setup","docker"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}