chroma-core/chroma · error · ChromaValueError

Keyword argument ' ' has a value of type ' ', which is not…

Error message

Keyword argument '${key}' has a value of type '${typeof value}', which is not supported. Only JSON-serializable values are allowed.

What it means

Constructor guard on SentenceTransformers kwargs: one of the values is a function, Symbol, or otherwise non-JSON-serializable value. kwargs must round-trip through config serialization, so such values cannot be stored or reloaded.

Solutions

  1. Replace non-serializable kwarg values with plain data (numbers, strings, booleans, arrays, objects)
  2. Pass functions via wrapper code at call time instead of kwargs
  3. Validate with JSON.stringify before constructing
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at clients/new-js/packages/ai-embeddings/sentence-transformer/src/index.ts:49 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/9f58bb55ca629f50. Report an issue: GitHub.

Appendix: source

Thrown at clients/new-js/packages/ai-embeddings/sentence-transformer/src/index.ts:49

    private readonly modelName: string;
    private readonly device: string;
    private readonly normalizeEmbeddings: boolean;
    private readonly kwargs: Record<string, any>;
    private pipelinePromise: Promise<any> | null = null;
    private pipeline: any = null;

    constructor(args: SentenceTransformersArgs = {}) {
        const {
            modelName = "all-MiniLM-L6-v2",
            device = "cpu",
            normalizeEmbeddings = false,
            kwargs = {},
        } = args;

        // Validate kwargs are JSON-serializable (no functions or symbols)
        for (const [key, value] of Object.entries(kwargs)) {
            if (typeof value === "function" || typeof value === "symbol") {
                throw new ChromaValueError(
                    `Keyword argument '${key}' has a value of type '${typeof value}', which is not supported. Only JSON-serializable values are allowed.`
                );
            }
        }

        this.modelName = modelName;
        this.device = device;
        this.normalizeEmbeddings = normalizeEmbeddings;
        this.kwargs = kwargs;
    }

    private async getPipeline(): Promise<any> {
        if (this.pipeline) {
            return this.pipeline;
        }

        if (!this.pipelinePromise) {
            // Resolve model name: if it doesn't contain a '/', prefix with 'Xenova/'

View on GitHub (pinned to aecdd12c8a)