R RockAI docs

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:

  1. Drops the existing Vectorize index.
  2. Re-creates it at the dimension that matches your currently-configured embedding model.
  3. Deletes every local Chunk row.
  4. Resets every Source to status = pending.
  5. Re-dispatches IndexDocumentJob for 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:

ModelDim
@cf/baai/bge-small-en-v1.5384
@cf/baai/bge-base-en-v1.5 (default)768
@cf/baai/bge-large-en-v1.51024
@cf/baai/bge-m31024
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:

  1. Pre-flight guard in VectorizeClient::upsertPoints and ::search (added 2026-05-15/16) rejects mismatched vectors locally with an actionable message naming the vector:rebuild-index command โ€” before paying for a Cloudflare round-trip that would just return 40006 / 40012.
  2. 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.