Bug: Qdrant collection created with wrong vector dimension when using Ollama embeddings
Environment
- OpenClaw: 2026.2.26 (bc50708)
- Plugin: openclaw-mem0
- Embedding model:
nomic-embed-text (via Ollama)
- Vector store: Qdrant 1.17.0
- Qdrant JS client: @qdrant/js-client-rest 1.13.0 → 1.17.0 (manually upgraded)
Problem
When using openclaw mem0 search, the command fails with:
Search failed: Error: Bad Request
The root cause is that mem0ai/dist/oss/index.js hardcodes 1536 as the default vector dimension in multiple places:
this.embeddingDims = config.embeddingDims || 1536;
this.dimension = config.dimension || 1536;
const testVector = Array(1536).fill(0);
dimension: 1536 // line 3690, not overridable via config
1536 is the dimension for OpenAI's text-embedding-ada-002, but nomic-embed-text outputs 768-dimensional vectors. This mismatch causes Qdrant to reject search requests with Bad Request.
Additionally, @qdrant/js-client-rest@1.13.0 (bundled) is incompatible with Qdrant server 1.17.0, which requires a manual upgrade of the client.
Steps to Reproduce
- Install openclaw-mem0 plugin
- Configure Qdrant as vector store with
nomic-embed-text as embedding model
- Run
openclaw mem0 search "anything"
- →
Search failed: Error: Bad Request
Root Cause
mem0ai was originally designed around OpenAI embeddings (1536 dims). When Ollama support was added, the default dimension was never updated to match models like nomic-embed-text (768 dims).
Workaround
Manually patch node_modules/mem0ai/dist/oss/index.js:
sed -i '' 's/config.embeddingDims || 1536/config.embeddingDims || 768/g' ~/.openclaw/extensions/openclaw-mem0/node_modules/mem0ai/dist/oss/index.js
sed -i '' 's/config.dimension || 1536/config.dimension || 768/g' ~/.openclaw/extensions/openclaw-mem0/node_modules/mem0ai/dist/oss/index.js
sed -i '' 's/Array(1536).fill(0)/Array(768).fill(0)/g' ~/.openclaw/extensions/openclaw-mem0/node_modules/mem0ai/dist/oss/index.js
sed -i '' 's/vector(1536)/vector(768)/g' ~/.openclaw/extensions/openclaw-mem0/node_modules/mem0ai/dist/oss/index.js
sed -i '' 's/dimension: 1536/dimension: 768/g' ~/.openclaw/extensions/openclaw-mem0/node_modules/mem0ai/dist/oss/index.js
Then delete and recreate the Qdrant collection:
curl -X DELETE "http://<qdrant-host>:6333/collections/memories"
Expected Behavior
- The default embedding dimension should be dynamically inferred from the configured embedding model, not hardcoded to 1536.
- Alternatively,
config.dimension should override all hardcoded values including line 3690.
- The bundled
@qdrant/js-client-rest version should be kept in sync with recent Qdrant server releases.
Suggested Fix
// Detect dimension from embedding model instead of hardcoding
const embeddingDims = config.embeddingDims ?? (await this.getEmbeddingDimension());
Or at minimum, document the required embeddingDims config value clearly when using non-OpenAI embedding models.
Bug: Qdrant collection created with wrong vector dimension when using Ollama embeddings
Environment
nomic-embed-text(via Ollama)Problem
When using
openclaw mem0 search, the command fails with:The root cause is that
mem0ai/dist/oss/index.jshardcodes1536as the default vector dimension in multiple places:1536is the dimension for OpenAI'stext-embedding-ada-002, butnomic-embed-textoutputs 768-dimensional vectors. This mismatch causes Qdrant to reject search requests withBad Request.Additionally,
@qdrant/js-client-rest@1.13.0(bundled) is incompatible with Qdrant server1.17.0, which requires a manual upgrade of the client.Steps to Reproduce
nomic-embed-textas embedding modelopenclaw mem0 search "anything"Search failed: Error: Bad RequestRoot Cause
mem0aiwas originally designed around OpenAI embeddings (1536 dims). When Ollama support was added, the default dimension was never updated to match models likenomic-embed-text(768 dims).Workaround
Manually patch
node_modules/mem0ai/dist/oss/index.js:Then delete and recreate the Qdrant collection:
curl -X DELETE "http://<qdrant-host>:6333/collections/memories"Expected Behavior
config.dimensionshould override all hardcoded values including line 3690.@qdrant/js-client-restversion should be kept in sync with recent Qdrant server releases.Suggested Fix
Or at minimum, document the required
embeddingDimsconfig value clearly when using non-OpenAI embedding models.