{"record":{"id":"526eda47006ba94a","repo":"hyperledger/fabric","slug":"the-following-existing-collections-are-missing-in-526eda","errorCode":null,"errorMessage":"the following existing collections are missing in the new collection configuration package: %v","messagePattern":"the following existing collections are missing in the new collection configuration package: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v13/lscc_validation_logic.go","lineNumber":145,"sourceCode":"\t// number of new collections are allowed.\n\tfor _, oldCollectionConfig := range oldCollectionConfigs {\n\n\t\toldCollection := oldCollectionConfig.GetStaticCollectionConfig()\n\t\t// It cannot be nil\n\t\tif oldCollection == nil {\n\t\t\treturn policyErr(fmt.Errorf(\"unknown collection configuration type\"))\n\t\t}\n\n\t\t// All old collection must exist in the new collection config package\n\t\toldCollectionName := oldCollection.GetName()\n\t\t_, ok := newCollectionsMap[oldCollectionName]\n\t\tif !ok {\n\t\t\tmissingCollections = append(missingCollections, oldCollectionName)\n\t\t}\n\t}\n\n\tif len(missingCollections) > 0 {\n\t\treturn policyErr(fmt.Errorf(\"the following existing collections are missing in the new collection configuration package: %v\",\n\t\t\tmissingCollections))\n\t}\n\n\treturn nil\n}\n\nfunc checkForModifiedCollectionsBTL(newCollectionsMap map[string]*pb.StaticCollectionConfig, oldCollectionConfigs []*pb.CollectionConfig,\n) error {\n\tvar modifiedCollectionsBTL []string\n\n\t// In the new collection config package, ensure that the block to live value is not\n\t// modified for the existing collections.\n\tfor _, oldCollectionConfig := range oldCollectionConfigs {\n\n\t\toldCollection := oldCollectionConfig.GetStaticCollectionConfig()\n\t\t// It cannot be nil\n\t\tif oldCollection == nil {\n\t\t\treturn policyErr(fmt.Errorf(\"unknown collection configuration type\"))","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v13/lscc_validation_logic.go#L127-L163","documentation":"During a chaincode upgrade, checkForMissingCollections verifies that every collection defined in the existing (old) collection config is still present in the new package. Private data collections cannot be removed via upgrade, so if any old collection name is absent from the new config, the transaction is rejected with the list of missing collection names.","triggerScenarios":"Submitting an upgrade with a new collections-config that omits one or more collections that existed in the previous definition, e.g. old config had coll1 and coll2, new config only lists coll1.","commonSituations":"Creating a fresh collections JSON for the upgrade instead of extending the original; intentionally trying to 'delete' a collection via upgrade (unsupported); copy/paste truncation of the config file.","solutions":["Add all existing collection definitions back into the new collections config, unchanged where possible","To stop writing new data to a collection, keep the definition but you cannot remove it; plan archival/retention via BlockToLive instead of deleting","Generate the new config by loading the old collection config and appending new collections rather than authoring from scratch"],"exampleFix":"// before (new config for upgrade from coll1+coll2)\n[{\"name\": \"coll1\"}]\n// after\n[{\"name\": \"coll1\"}, {\"name\": \"coll2\"}]","handlingStrategy":"validation","validationCode":"function validateUpgradeCollections(oldConfigs, newConfigs) {\n  const newNames = new Set(newConfigs.map(c => c.name));\n  const missing = oldConfigs.filter(c => !newNames.has(c.name)).map(c => c.name);\n  if (missing.length) {\n    throw new Error(`existing collections missing from new config: ${missing.join(', ')}`);\n  }\n}","typeGuard":"function containsAllOldCollections(oldConfigs, newConfigs) {\n  const names = new Set(newConfigs.map(c => c.name));\n  return oldConfigs.every(c => names.has(c.name));\n}","tryCatchPattern":"try {\n  await contract.submitTransaction('UpgradeChaincode', ...args);\n} catch (err) {\n  if (String(err).includes('existing collections are missing')) {\n    // parse listed names, merge them back into the new config, resubmit\n  }\n  throw err;\n}","preventionTips":["Always derive upgrade configs from the previously committed collection definitions","Remember collections cannot be deleted via upgrade — plan retention with blockToLive instead","Diff old vs new collection name sets in CI before submitting upgrades"],"tags":["hyperledger-fabric","private-data","collection-upgrade","validation"],"backgroundTag":"collection-config-incompatible","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}