{"record":{"id":"9eaea52afbf1b082","repo":"hyperledger/fabric","slug":"collection-data-should-not-exist-for-chaincode-s-9eaea5","errorCode":null,"errorMessage":"collection data should not exist for chaincode %s:%s","messagePattern":"collection data should not exist for chaincode (.+?):(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v13/lscc_validation_logic.go","lineNumber":284,"sourceCode":"\n\t// The following condition check added in v1.1 may not be needed as it is not possible to have the chaincodeName~collection key in\n\t// the lscc namespace before a chaincode deploy. To avoid forks in v1.2, the following condition is retained.\n\tif lsccFunc == lscc.DEPLOY {\n\t\tcolCriteria := privdata.CollectionCriteria{Channel: channelName, Namespace: cdRWSet.Name}\n\t\tccp, err := privdata.RetrieveCollectionConfigPackageFromState(colCriteria, state)\n\t\tif err != nil {\n\t\t\t// fail if we get any error other than NoSuchCollectionError\n\t\t\t// because it means something went wrong while looking up the\n\t\t\t// older collection\n\t\t\tif _, ok := err.(privdata.NoSuchCollectionError); !ok {\n\t\t\t\treturn &commonerrors.VSCCExecutionFailureError{\n\t\t\t\t\tErr: fmt.Errorf(\"unable to check whether collection existed earlier for chaincode %s:%s\",\n\t\t\t\t\t\tcdRWSet.Name, cdRWSet.Version),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ccp != nil {\n\t\t\treturn policyErr(fmt.Errorf(\"collection data should not exist for chaincode %s:%s\", cdRWSet.Name, cdRWSet.Version))\n\t\t}\n\t}\n\n\t// TODO: Once the new chaincode lifecycle is available (FAB-8724), the following validation\n\t// and other validation performed in ValidateLSCCInvocation can be moved to LSCC itself.\n\tnewCollectionConfigPackage := &pb.CollectionConfigPackage{}\n\n\tif collectionsConfigArg != nil {\n\t\terr := proto.Unmarshal(collectionsConfigArg, newCollectionConfigPackage)\n\t\tif err != nil {\n\t\t\treturn policyErr(fmt.Errorf(\"invalid collection configuration supplied for chaincode %s:%s\",\n\t\t\t\tcdRWSet.Name, cdRWSet.Version))\n\t\t}\n\t} else {\n\t\treturn nil\n\t}\n\n\tif ac.V1_2Validation() {","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v13/lscc_validation_logic.go#L266-L302","documentation":"During a DEPLOY, the ledger already contains a collection config package for this chaincode (retrieved via CollectionCriteria). New deploys must start with no pre-existing collection data to avoid state forks (v1.1 compatibility check).","triggerScenarios":"Thrown at core/handlers/validation/builtin/v13/lscc_validation_logic.go:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify whether the chaincode was already deployed on the channel","Clean up stale collection state or use a different chaincode name/version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}