{"record":{"id":"c9ee3df31d3cef30","repo":"hyperledger/fabric","slug":"no-instantiation-policy-was-specified-c9ee3d","errorCode":null,"errorMessage":"No instantiation policy was specified","messagePattern":"No instantiation policy was specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":712,"sourceCode":"\t\t\tif ac.V1_2Validation() {\n\t\t\t\t// do extra validation for collections\n\t\t\t\terr := vscc.validateRWSetAndCollection(lsccrwset, cdRWSet, lsccArgs, lsccFunc, ac, chid)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// there can only be a single ledger write\n\t\t\t\tif len(lsccrwset.Writes) != 1 {\n\t\t\t\t\treturn policyErr(fmt.Errorf(\"LSCC can only issue a single putState upon upgrade\"))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/*****************************************************/\n\t\t\t/* security check 4 - check the instantiation policy */\n\t\t\t/*****************************************************/\n\t\t\tpol := cdLedger.InstantiationPolicy\n\t\t\tif pol == nil {\n\t\t\t\treturn policyErr(fmt.Errorf(\"No instantiation policy was specified\"))\n\t\t\t}\n\t\t\t// FIXME: could we actually pull the cds package from the\n\t\t\t// file system to verify whether the policy that is specified\n\t\t\t// here is the same as the one on disk?\n\t\t\t// PROS: we prevent attacks where the policy is replaced\n\t\t\t// CONS: this would be a point of non-determinism\n\t\t\terr := vscc.checkInstantiationPolicy(chid, env, pol, payl)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t/******************************************************************/\n\t\t\t/* security check 5 - check the instantiation policy in the rwset */\n\t\t\t/******************************************************************/\n\t\t\tif ac.V1_1Validation() {\n\t\t\t\tpolNew := cdRWSet.InstantiationPolicy\n\t\t\t\tif polNew == nil {\n\t\t\t\t\treturn policyErr(fmt.Errorf(\"No instantiation policy was specified\"))","sourceCodeStart":694,"sourceCodeEnd":730,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L694-L730","documentation":"Every instantiated chaincode record (ChaincodeData) on the ledger must carry an instantiation policy. When validating an UPGRADE, if the existing ledger record has no InstantiationPolicy, VSCC rejects the transaction because there is no policy against which to evaluate endorsement authority.","triggerScenarios":"An lscc UPGRADE transaction where cdLedger.InstantiationPolicy is nil — i.e., the on-ledger chaincode data lacks an instantiation policy.","commonSituations":"Ledger state written by non-standard or buggy lifecycle tooling; state migrated/manually crafted without the policy field; corrupted chaincode data after a fork or improper restore.","solutions":["Re-instantiate/upgrade through standard LSCC so a proper instantiation policy is written","Restore ledger state from a known-good backup produced by standard lifecycle operations","Audit any custom migration tooling to ensure ChaincodeData includes InstantiationPolicy"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const cd = ledgerState.get(chaincodeDataKey);\nif (!cd || !cd.instantiation_policy) {\n  throw new Error('Ledger chaincode data missing instantiation policy');\n}","typeGuard":"function hasInstantiationPolicy(cd) {\n  return cd != null && typeof cd.instantiation_policy === 'string' && cd.instantiation_policy.length > 0;\n}","tryCatchPattern":"try {\n  await upgrade(...);\n} catch (e) {\n  if (String(e).includes('No instantiation policy was specified')) {\n    // ledger state is non-standard; restore via standard lifecycle ops\n  }\n}","preventionTips":["Only write chaincode data through standard LSCC operations","Verify backups/migrations preserve all ChaincodeData fields","Audit custom lifecycle tooling for omitted policy fields"],"tags":["hyperledger-fabric","vscc","instantiation-policy","lscc"],"backgroundTag":"missing-instantiation-policy","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"}