Bug: `search_code` fails with "Cannot read properties of null (reading 'scores')" while index is completed
Author: KevinInceCreated Jun 9, 2026Updated Jun 27, 2026
Bug: search_code fails with "Cannot read properties of null (reading 'scores')" while index is completed
Environment
- claude-context version: latest (
@zilliz/claude-context-mcp@latest, also tested with local binary at/usr/local/node/bin/claude-context-mcp) - OS: Linux (production server, no internet access)
- Node.js: (v22.22.3)
- Embedding provider: Ollama
- Embedding model:
nomic-embed-text(dimension: 768) - Ollama host:
http://127.0.0.1:11434 - Milvus:
http://127.0.0.1:19530(no auth token)
Steps to reproduce
- Index a Python codebase:
echo '{"jsonrpc":"2.0","id":"1","method":"tools/call","params":{"name":"index_codebase","arguments":{"path":"/data1/my-project"}}}' | \
EMBEDDING_PROVIDER=Ollama EMBEDDING_MODEL=nomic-embed-text OLLAMA_HOST=http://127.0.0.1:11434 EMBEDDING_DIMENSION=768 MILVUS_ADDRESS=http://127.0.0.1:19530 MILVUS_TOKEN="" \
claude-context-mcp 2>/dev/null
2. Confirm indexing is complete:
echo '{"jsonrpc":"2.0","id":"2","method":"tools/call","params":{"name":"get_indexing_status","arguments":{"path":"/data1/my-project"}}}' | \
...same env... claude-context-mcp 2>/dev/null
Output:
✅ Codebase '/data1/my-project' is fully indexed and ready for search.
Statistics: 31 files, 893 chunks
Status: completed
3. Search the indexed codebase:
echo '{"jsonrpc":"2.0","id":"3","method":"tools/call","params":{"name":"search_code","arguments":{"path":"/data1/my-project","query":"agent","limit":5}}}' | \
...same env... claude-context-mcp 2>/dev/null
Expected behavior
Returns code search results (relevant file paths and code snippets matching "agent").
Actual behavior
Always returns an internal error:
{
"result": {
"content": [{
"type": "text",
"text": "Error searching code: Cannot read properties of null (reading 'scores') Please check if the codebase has been indexed first."
}],
"isError": true
},
"jsonrpc": "2.0",
"id": "3"
}
Additional context
- get_indexing_status reports completed and shows correct file/chunk counts
- Ollama embedding API is working correctly (tested via curl http://127.0.0.1:11434/api/embeddings)
- The path and query arguments are both valid strings (verified before sending)
- Same error with both AST splitter and langchain splitter
- Same error with both the local binary and npx @zilliz/claude-context-mcp@latest
- The error appears to be a JavaScript TypeError where the result from Milvus is null/undefined and .scores is accessed without a null check
- This is reproducible 100% of the time — index_codebase and get_indexing_status work perfectly, but search_code always fails with this errorSource: zilliztech/claude-context