chroma-core/chroma · error · ChromaValueError

Cannot embed string query for key

Error message

Cannot embed string query for key '${key}': no embedding function configured. Provide an embedded vector or configure an embedding function.

What it means

Guard in embedKnnLiteral (called from entries): a string KNN query value cannot be converted to a vector because the key's vector index has no embedding function configured; the caller must supply an already-embedded vector or attach an embedding function to the index.

Solutions

  1. Configure an embedding function on the key's vector index (e.g. via schema.create_index(VectorIndexConfig({embeddingFunction}))).
  2. Pass a pre-computed embedding vector as the query.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at clients/new-js/packages/chromadb/src/collection.ts:697 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/cd09d22ef8861aae. Report an issue: GitHub.

Appendix: source

Thrown at clients/new-js/packages/chromadb/src/collection.ts:697

    }

    const vectorIndex = valueTypes.floatList?.vectorIndex;
    if (vectorIndex?.enabled && vectorIndex.config.embeddingFunction) {
      const embeddingFunction = vectorIndex.config.embeddingFunction;
      const embeddings = embeddingFunction.generateForQueries
        ? await embeddingFunction.generateForQueries([queryValue])
        : await embeddingFunction.generate([queryValue]);

      if (!embeddings || embeddings.length !== 1) {
        throw new ChromaValueError(
          "Embedding function returned unexpected number of embeddings.",
        );
      }

      return { ...knn, query: embeddings[0] };
    }

    throw new ChromaValueError(
      `Cannot embed string query for key '${key}': no embedding function configured. Provide an embedded vector or configure an embedding function.`,
    );
  }

  private async embedRankLiteral(rank: unknown): Promise<unknown> {
    if (rank === null || rank === undefined) {
      return rank;
    }

    if (Array.isArray(rank)) {
      return Promise.all(rank.map((item) => this.embedRankLiteral(item)));
    }

    if (!isPlainObject(rank)) {
      return rank;
    }

    const entries = await Promise.all(

View on GitHub (pinned to aecdd12c8a)