chroma-core/chroma · error · Error

Unsupported or missing CMEK provider in data: ${JSON.stringi

Error message

Unsupported or missing CMEK provider in data: ${JSON.stringify(data)}

What it means

Cmek.fromJSON deserializes customer-managed-encryption-key configuration, and the only provider shape it accepts is { gcp: '<key-resource-name>' } with a string value. Any other payload — a different provider key such as aws, an empty object, or a non-string gcp value — throws this error with the offending JSON embedded in the message.

Source

Thrown at clients/new-js/packages/chromadb/src/schema.ts:162

   * Deserialize CMEK from object format.
   *
   * Expects the provider variant as the key and resource as the value.
   *
   * @param data - Object containing provider variant and resource
   * @returns Deserialized CMEK instance
   * @throws Error if the provider is unsupported or data is malformed
   *
   * @example
   * ```typescript
   * const data = { gcp: 'projects/p/locations/l/keyRings/r/cryptoKeys/k' };
   * const cmek = Cmek.fromJSON(data);
   * ```
   */
  static fromJSON(data: Record<string, unknown>): Cmek {
    if ("gcp" in data && typeof data.gcp === "string") {
      return Cmek.gcp(data.gcp);
    }
    throw new Error(
      `Unsupported or missing CMEK provider in data: ${JSON.stringify(data)}`,
    );
  }
}

const STRING_VALUE_NAME = "string";
const FLOAT_LIST_VALUE_NAME = "float_list";
const SPARSE_VECTOR_VALUE_NAME = "sparse_vector";
const INT_VALUE_NAME = "int";
const FLOAT_VALUE_NAME = "float";
const BOOL_VALUE_NAME = "bool";

const FTS_INDEX_NAME = "fts_index";
const STRING_INVERTED_INDEX_NAME = "string_inverted_index";
const VECTOR_INDEX_NAME = "vector_index";
const SPARSE_VECTOR_INDEX_NAME = "sparse_vector_index";
const INT_INVERTED_INDEX_NAME = "int_inverted_index";
const FLOAT_INVERTED_INDEX_NAME = "float_inverted_index";

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Construct the GCP CMEK directly: schema.setCmek(Cmek.gcp('projects/p/locations/l/keyRings/r/cryptoKeys/k')).
  2. Validate the parsed JSON has a string gcp field before calling fromJSON.
  3. If you need another cloud provider, check for a newer client release — this version supports GCP only.

Example fix

// before
schema.setCmek(Cmek.fromJSON(data)); // data = { aws: keyArn } -> throws

// after
if (typeof data.gcp !== 'string') {
  throw new Error('CMEK config must be { gcp: string }');
}
schema.setCmek(Cmek.fromJSON({ gcp: data.gcp }));
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(typeof data === 'object' && data !== null && typeof (data as { gcp?: unknown }).gcp === 'string')) {
  throw new Error('CMEK payload must be { gcp: string }');
}
const cmek = Cmek.fromJSON(data as { gcp: string });

Type guard

function isGcpCmekJSON(data: unknown): data is { gcp: string } {
  return (
    typeof data === 'object' &&
    data !== null &&
    typeof (data as { gcp?: unknown }).gcp === 'string' &&
    Object.keys(data).length === 1
  );
}

Try / catch

try {
  schema.setCmek(Cmek.fromJSON(data));
} catch (e) {
  if (e instanceof Error && e.message.includes('CMEK provider')) {
    // fail provisioning with a clear message, or proceed without CMEK per policy
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Cmek.fromJSON({}); Cmek.fromJSON({ aws: 'arn:aws:kms:...' }); Cmek.fromJSON({ gcp: 42 }); feeding server-returned or file-based config JSON whose shape changed between client versions.

Common situations: Anticipating AWS/Azure KMS support when only GCP is implemented; round-tripping config through JSON and losing the gcp string; version drift where the serialized Cmek shape changed on upgrade.

Related errors


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