Embedding Dimension Mismatch Error (2026)

The Error

ValueError: Dimension mismatch: vector store expects 1536 dimensions but received 1024 dimensions from embedding model

This error occurs when you switch embedding models but your vector database still contains embeddings from the previous model with a different dimensionality.

The Fix

  1. Check what dimension your current model outputs:
# Voyage AI (commonly used with Claude)
# voyage-3: 1024 dimensions
# voyage-3-large: 1536 dimensions
# voyage-code-3: 1024 dimensions
  1. Rebuild your vector index with the correct dimensions:
python3 -c "
# Example for ChromaDB
import chromadb
client = chromadb.PersistentClient(path='./chroma_db')
# Delete and recreate collection with correct dimensions
client.delete_collection('documents')
collection = client.create_collection(
    name='documents',
    metadata={'hnsw:space': 'cosine', 'dimension': 1024}
)
print('Collection recreated with 1024 dimensions')
"
  1. Re-embed all documents with the new model:
python3 reindex.py --model voyage-3 --dimension 1024

Why This Happens

Vector databases store embeddings at a fixed dimensionality defined at index creation time. When you change embedding models (e.g., from voyage-3-large at 1536d to voyage-3 at 1024d), the new vectors cannot be inserted into or compared against the old index. The dimensions must match exactly.

If That Doesn’t Work

  • If using pgvector, alter the column dimension:
ALTER TABLE documents DROP COLUMN embedding;
ALTER TABLE documents ADD COLUMN embedding vector(1024);
  • If using Pinecone, you must create a new index (dimensions are immutable).
  • Verify the model name is correct — typos silently change the output dimension.

Prevention

Add this to your CLAUDE.md:

# Embeddings
- Pin embedding model version in config. Never change without reindexing.
- Document the dimension in your schema: voyage-3 = 1024, voyage-3-large = 1536.
- Add a dimension check assertion before inserting vectors.

See Also

This fix also applies if you see variations of this error:

  • Connection or process errors with similar root causes in the same subsystem
  • Timeout variants where the operation starts but does not complete
  • Permission variants where access is denied to the same resource
  • Configuration variants where the same setting is missing or malformed

If your specific error message differs slightly from the one shown above, the fix is likely the same. The key indicator is the operation that failed (shown in the stack trace) rather than the exact wording of the message.

Frequently Asked Questions

Does this error affect all operating systems?

This error can occur on macOS, Linux, and Windows (WSL). The exact error message may differ slightly between platforms, but the root cause and fix are the same. macOS users may see additional Gatekeeper or notarization prompts. Linux users should check that the relevant system packages are installed. Windows users should ensure they are running inside WSL2, not native Windows.

Will this error come back after updating Claude Code?

Updates can occasionally reintroduce this error if the update changes default configurations or dependency requirements. After updating Claude Code, verify your project still builds and runs correctly. If the error returns, reapply the fix and check the changelog for breaking changes.

Can this error cause data loss?

No, this error occurs before or during an operation and does not corrupt existing files. Claude Code’s edit operations are atomic — they either complete fully or not at all. However, if the error occurs during a multi-step operation, you may have partial changes that need to be reviewed with git diff before continuing.

How do I report this error to Anthropic if the fix does not work?

Open an issue at github.com/anthropics/claude-code with: (1) the full error message including stack trace, (2) your Node.js version (node --version), (3) your Claude Code version (claude --version), (4) your operating system and version, and (5) the command or operation that triggered the error.

Try it: Paste your error into our Error Diagnostic for an instant fix.