Skip to content

runtimedb: vector index creation fails with 'could not detect dimension' on some tables #52

Description

@rohan-hotdata

Building a vector index on an existing embedding column fails on some tables with
could not detect dimension for '<column>', and reproduces on retry for the same table
while structurally similar tables index successfully. The trigger was not identified.

This blocks the HNSW fast path for HotdataVectorStore on any table that lands in this
state, and there is no client-side workaround (see "Why this cannot be fixed in the client"
below).

What happened

While verifying the vector fast path for HotdataVectorStore (hotdata-langchain 0.4.0),
we created cosine vector indexes on seven managed tables in a live workspace
(api.hotdata.dev). Six succeeded. One failed with:

could not detect dimension for 'embedding'

The failure reproduced on retry against the same table. Recreating an equivalent table
from scratch and indexing it succeeded, so the problem is table state, not the schema.

All seven tables had the same relevant shape:

  • column embedding, arrow type List(Float32), 1536 dimensions (OpenAI
    text-embedding-3-small)
  • written through load_managed_table(..., mode="upsert", key=["id"]) from a pyarrow
    table serialised to parquet
  • index request: index_type="vector", metric="cosine", columns=["embedding"]

How the failure surfaces

Index creation is an async job. The create_index call returns successfully with a job id
and status pending; the error only ever appears on the job record, in
JobsApi.get_job(id).error_message. A caller that does not poll sees a successful create
and an index that never materialises.

Hypotheses tested and ruled out

Each was checked by building a table exhibiting only that property and indexing it. All four
indexed successfully, so none of these is the trigger on its own:

Hypothesis Result
Parquet fragmentation from repeated upserts ruled out — a table with several successive upserts indexed fine
A prior mode="delete" load leaving tombstones ruled out — a table with a delete applied indexed fine
Promoted typed metadata columns alongside the vector column ruled out — indexed fine
The List(Float32) column type itself ruled out — it is indexable; six tables with that exact type succeeded

We stopped after six controlled reproductions rather than continue guessing. Whatever the
trigger is, it is some accumulated table state that the dimension-detection step does not
handle, and it is not any of the obvious candidates above.

Why this cannot be fixed in the client

hotdata-framework 0.10.0's create_index accepts a dimensions argument, but it does not
apply here. Per its own contract, when indexing an existing vector column the width is
read from the data; dimensions applies only to the provider-backed path, where the engine
embeds a source text column itself. So passing dimensions=1536 — which we were doing — is
ignored on this path, and there is no argument a caller can supply to bypass detection.

That means every consumer that indexes an existing embedding column is exposed:
hotdata-langchain's HotdataVectorStore, and anything built on
hotdata-dlt-destination's write side once its embedding adapter lands.

What would resolve this

Either of:

  1. Make detection robust to whatever table state defeats it. Ideally the detection step
    reports what it saw when it fails (file count, first row inspected, the type it read)
    rather than a bare "could not detect".
  2. Let the caller assert the width on the existing-column path too, so dimensions= is
    honoured as an override rather than ignored. This is the smaller change and unblocks
    consumers immediately, but leaves the underlying detection bug in place.

A better error message is worth having regardless of which is chosen. The current text names
the column but nothing about why detection failed, which is what made this take six
reproductions to not diagnose.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-native-layerPart of the AI-native query layer effort for LangChainbugSomething isn't workingrepo:runtimedbImplementation lands in runtimedb (engine)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions