chroma-core/chroma · error · ChromaValueError
Config is missing a required field
Error message
Config is missing a required field
What it means
Thrown by the static buildFromConfig() of ChromaCloudQwenEmbeddingFunction with a ChromaValueError when the config object being deserialized lacks model or task. Chroma stores embedding-function configs and rebuilds functions from them (e.g., when a collection is re-opened); those two fields are required to reconstruct the Qwen function, so their absence is a config corruption or schema drift signal.
Source
Thrown at clients/new-js/packages/ai-embeddings/chroma-cloud-qwen/src/index.ts:196
throw new Error(`Error calling Chroma Embedding API: ${error}`);
}
}
}
public defaultSpace(): EmbeddingFunctionSpace {
return "cosine";
}
public supportedSpaces(): EmbeddingFunctionSpace[] {
return ["cosine", "l2", "ip"];
}
public static buildFromConfig(
config: ChromaCloudQwenConfig,
client?: ChromaClient,
): ChromaCloudQwenEmbeddingFunction {
if (config.model === undefined || config.task === undefined) {
throw new ChromaValueError("Config is missing a required field");
}
// Deserialize instructions dict from string keys to enum keys (if needed)
// The config.instructions will have string keys like "nl_to_code" and "documents"
// We need to convert these to the enum values for proper runtime usage
let deserializedInstructions: ChromaCloudQwenEmbeddingInstructions;
if (config.instructions) {
deserializedInstructions = {} as ChromaCloudQwenEmbeddingInstructions;
for (const [taskKey, targets] of Object.entries(config.instructions)) {
deserializedInstructions[taskKey] = {} as Record<
ChromaCloudQwenEmbeddingTarget,
string
>;
for (const [targetKey, instruction] of Object.entries(targets)) {
// targetKey is the enum value string like "documents" or "query"
const targetEnum = targetKey as ChromaCloudQwenEmbeddingTarget;
deserializedInstructions[taskKey][targetEnum] = instruction;View on GitHub (pinned to aecdd12c8a)
Solutions
- Include both required fields: config.model (a ChromaCloudQwenEmbeddingModel value) and config.task (string or null).
- Build configs from a live instance: new ChromaCloudQwenEmbeddingFunction(...).getConfig() round-trips every required field.
- If loading stored configs from an older version, backfill model/task before calling buildFromConfig.
Example fix
// before
const ef = ChromaCloudQwenEmbeddingFunction.buildFromConfig({
api_key_env_var: "CHROMA_API_KEY",
}); // no model/task
// after
const ef = ChromaCloudQwenEmbeddingFunction.buildFromConfig({
model: ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B,
task: null,
api_key_env_var: "CHROMA_API_KEY",
}); Defensive patterns
Strategy: validation
Validate before calling
function isCompleteQwenConfig(c: Partial<ChromaCloudQwenConfig>): c is ChromaCloudQwenConfig {
return c.model !== undefined && c.task !== undefined;
}
if (!isCompleteQwenConfig(storedConfig)) {
throw new Error("Stored Qwen config is missing model or task; backfill before rebuild");
}
const ef = ChromaCloudQwenEmbeddingFunction.buildFromConfig(storedConfig); Type guard
function isCompleteQwenConfig(c: unknown): c is ChromaCloudQwenConfig {
if (typeof c !== "object" || c === null) return false;
const cfg = c as Record<string, unknown>;
return typeof cfg.model === "string" && (cfg.task === null || typeof cfg.task === "string");
} Prevention
- Persist configs via getConfig() so all required fields are captured.
- Validate stored configs after library upgrades before rebuilding functions.
- Add schema checks (model, task present) when loading configs from YAML/JSON.
When it happens
Trigger: Passing a hand-built config to buildFromConfig({ config }) with only api_key_env_var or instructions; loading a persisted collection whose stored EF config was written by an older library version without model/task; YAML/JSON config file missing the fields.
Common situations: Migrating between chromadb JS versions where the config schema changed; manually crafting EF configs instead of using getConfig() from a live instance; truncated config stores.
Related errors
- The model name cannot be changed after initialization.
- The task type cannot be changed after initialization.
- Changing the URL is not allowed.
- Cannot change model name.
- Model cannot be updated
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/b6ed7e5b74c57934.
Report an issue: GitHub.