{"record":{"id":"3f9154e2e4392cc4","repo":"chroma-core/chroma","slug":"no-valid-configuration-fields-provided-for-update","errorCode":null,"errorMessage":"No valid configuration fields provided for update.","messagePattern":"No valid configuration fields provided for update\\.","errorType":"validation","errorClass":"InvalidConfigurationError","httpStatus":null,"severity":"error","filePath":"clients/js/packages/chromadb-core/src/CollectionConfiguration.ts","lineNumber":347,"sourceCode":"        \"Invalid SPANN config provided in UpdateCollectionConfiguration\",\n      );\n    }\n  }\n\n  // Handle embedding function serialization only if explicitly provided (ef !== undefined)\n  if (ef !== undefined) {\n    efConfig = serializeEmbeddingFunction(ef);\n  }\n\n  // Construct the result object, only including defined fields\n  const result: Record<string, any> = {};\n  if (hnswConfig !== undefined) result.hnsw = hnswConfig;\n  if (spannConfig !== undefined) result.spann = spannConfig;\n  if (efConfig !== undefined) result.embedding_function = efConfig;\n\n  // Check if the result is empty, which means no valid update fields were provided\n  if (Object.keys(result).length === 0) {\n    throw new InvalidConfigurationError(\n      \"No valid configuration fields provided for update.\",\n    );\n  }\n\n  return result;\n}\n\nexport function loadApiUpdateCollectionConfigurationFromUpdateCollectionConfiguration(\n  config: UpdateCollectionConfiguration,\n): Api.UpdateCollectionConfiguration {\n  return updateCollectionConfigurationToJson(\n    config,\n  ) as Api.UpdateCollectionConfiguration;\n}\n\n/**\n * Checks if there are conflicting embedding functions between function parameter\n * and collection configuration.","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/js/packages/chromadb-core/src/CollectionConfiguration.ts#L329-L365","documentation":"updateCollectionConfigurationToJson builds the JSON payload from only three optional fields (hnsw, spann, embedding_function) and throws InvalidConfigurationError if the result object is empty. collection.modify({ configuration }) with a configuration in which all three fields are undefined is a no-op the client refuses to send. Note that name and metadata are separate arguments to modify, not members of configuration.","triggerScenarios":"collection.modify({ configuration: {} }); collection.modify({ configuration: { hnsw: undefined, spann: maybeSpann } }) where maybeSpann is undefined; conditionally-constructed payloads where every branch produced undefined.","commonSituations":"Generic 'apply optional updates' code that always passes a configuration object even when the user only wanted rename/metadata changes; spreading optional config ({ ...opts }) whose keys are all absent; migration code that used to send embedding_function but now leaves it out.","solutions":["Omit the configuration argument entirely when you only want to change name or metadata: await col.modify({ name: 'new' }).","Ensure at least one of hnsw, spann, embedding_function is defined in the configuration you pass.","Strip undefined keys and skip the configuration update when none remain: if (Object.keys(cfg).length === 0) skip."],"exampleFix":"// before\nawait col.modify({ name: 'renamed', configuration: {} });\n\n// after\nawait col.modify({ name: 'renamed' });","handlingStrategy":"validation","validationCode":"const cfg: UpdateCollectionConfiguration = { /* maybe empty */ };\nconst hasUpdateFields =\n  cfg.hnsw !== undefined || cfg.spann !== undefined || cfg.embedding_function !== undefined;\n\nawait col.modify({\n  name,\n  metadata,\n  ...(hasUpdateFields ? { configuration: cfg } : {}), // omit configuration when nothing to update\n});","typeGuard":"function isNonEmptyUpdateConfig(\n  cfg: UpdateCollectionConfiguration,\n): boolean {\n  return (\n    cfg.hnsw !== undefined ||\n    cfg.spann !== undefined ||\n    cfg.embedding_function !== undefined\n  );\n}","tryCatchPattern":"try {\n  await col.modify({ configuration });\n} catch (e) {\n  if (e instanceof InvalidConfigurationError && e.message.includes('No valid configuration fields')) {\n    // nothing to update: treat as no-op success instead of failing\n  }\n  throw e;\n}","preventionTips":["Only include configuration in modify() when you actually intend to change hnsw/spann/embedding_function.","Remember name and metadata are siblings of configuration, not inside it.","Strip undefined keys from dynamically built payloads before deciding to send them."],"tags":["configuration","validation","update","empty-payload","collection-modify"],"backgroundTag":"missing-required-field","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}