Troubleshooting
Vector dim mismatch
Indexing is stuck across the board, or playground returns errors mentioning vector
dimensions. Tail of storage/logs/laravel.log shows:
Vectorize POST indexes/X/upsert failed:
{"code":40012,"message":"invalid vector for id=\"โฆ\",
expected 768 dimensions, and got 1024 dimensions"}
The Cloudflare Vectorize index was provisioned at one dimension (say 768) but the
embedding model now returns vectors of a different size (1024). Most common cause:
operator switched CLOUDFLARE_EMBED_MODEL from @cf/baai/bge-base-en-v1.5
(768 dim) to @cf/baai/bge-m3 or @cf/baai/bge-large-en-v1.5 (both 1024 dim)
without recreating the index.
Quick recovery
Pitchbar ships a single-command recovery flow. SSH to your server and run:
cd /path/to/pitchbar
php artisan vector:rebuild-index
Answer yes at the prompt. The command:
- Drops the existing Vectorize index.
- Re-creates it at the dimension that matches your currently-configured embedding model.
- Deletes every local
Chunkrow. - Resets every
Sourcetostatus = pending. - Re-dispatches
IndexDocumentJobfor every Document with persisted text.
Watch the queue worker โ the Knowledge view will refill as each document
re-embeds. URL-only Documents need a manual Reindex click after rebuild
(they re-crawl via CrawlPageJob on demand).
Known model dimensions
Pitchbar maps these embedding model slugs to dim automatically โ leave
VECTOR_DIM env unset and the
EmbedModelDimensions resolver picks
the right value:
| Model | Dim |
|---|---|
@cf/baai/bge-small-en-v1.5 | 384 |
@cf/baai/bge-base-en-v1.5 (default) | 768 |
@cf/baai/bge-large-en-v1.5 | 1024 |
@cf/baai/bge-m3 | 1024 |
text-embedding-3-small (OpenAI) | 1536 |
text-embedding-3-large (OpenAI) | 3072 |
text-embedding-ada-002 (OpenAI) | 1536 |
Flag overrides
--forceโ skip the confirmation prompt (useful for automation / CI rollouts)--dim=Nโ override the auto-resolved dim (advanced; only if you point at an unlisted model)
Why this happens
Cloudflare Vectorize indexes are immutable at the dimension level. Once provisioned
with config.dimensions = 768, you cannot resize it in place; you must
drop and recreate. Pitchbar adds two layers of defence so this doesn't bite the
operator silently:
-
Pre-flight guard in
VectorizeClient::upsertPointsand::search(added 2026-05-15/16) rejects mismatched vectors locally with an actionable message naming thevector:rebuild-indexcommand โ before paying for a Cloudflare round-trip that would just return 40006 / 40012. - ensureCollection dim check reads the existing index's dim on the first job per worker and throws an actionable error if it doesn't match the configured embed model's native dim.
Both pathways funnel the operator to the same recovery: run vector:rebuild-index.
Cost note
Re-embedding the entire knowledge base counts against Workers AI / OpenAI usage. For
typical CodeCanyon-scale buyers (under 1000 chunks), Cloudflare Workers AI's free tier
covers it. For OpenAI buyers, expect ~$0.02 per 1M tokens with text-embedding-3-small;
a 100-chunk knowledge base is well under $0.01.