hyperledger/fabric · error

No instantiation policy was specified

Error message

No instantiation policy was specified

What it means

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.

Source

Thrown at core/handlers/validation/builtin/v12/validation_logic.go:712

			if ac.V1_2Validation() {
				// do extra validation for collections
				err := vscc.validateRWSetAndCollection(lsccrwset, cdRWSet, lsccArgs, lsccFunc, ac, chid)
				if err != nil {
					return err
				}
			} else {
				// there can only be a single ledger write
				if len(lsccrwset.Writes) != 1 {
					return policyErr(fmt.Errorf("LSCC can only issue a single putState upon upgrade"))
				}
			}

			/*****************************************************/
			/* security check 4 - check the instantiation policy */
			/*****************************************************/
			pol := cdLedger.InstantiationPolicy
			if pol == nil {
				return policyErr(fmt.Errorf("No instantiation policy was specified"))
			}
			// FIXME: could we actually pull the cds package from the
			// file system to verify whether the policy that is specified
			// here is the same as the one on disk?
			// PROS: we prevent attacks where the policy is replaced
			// CONS: this would be a point of non-determinism
			err := vscc.checkInstantiationPolicy(chid, env, pol, payl)
			if err != nil {
				return err
			}

			/******************************************************************/
			/* security check 5 - check the instantiation policy in the rwset */
			/******************************************************************/
			if ac.V1_1Validation() {
				polNew := cdRWSet.InstantiationPolicy
				if polNew == nil {
					return policyErr(fmt.Errorf("No instantiation policy was specified"))

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Re-instantiate/upgrade through standard LSCC so a proper instantiation policy is written
  2. Restore ledger state from a known-good backup produced by standard lifecycle operations
  3. Audit any custom migration tooling to ensure ChaincodeData includes InstantiationPolicy
Defensive patterns

Strategy: validation

Validate before calling

const cd = ledgerState.get(chaincodeDataKey);
if (!cd || !cd.instantiation_policy) {
  throw new Error('Ledger chaincode data missing instantiation policy');
}

Type guard

function hasInstantiationPolicy(cd) {
  return cd != null && typeof cd.instantiation_policy === 'string' && cd.instantiation_policy.length > 0;
}

Try / catch

try {
  await upgrade(...);
} catch (e) {
  if (String(e).includes('No instantiation policy was specified')) {
    // ledger state is non-standard; restore via standard lifecycle ops
  }
}

Prevention

When it happens

Trigger: An lscc UPGRADE transaction where cdLedger.InstantiationPolicy is nil — i.e., the on-ledger chaincode data lacks an instantiation policy.

Common situations: 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.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/c9ee3df31d3cef30. Report an issue: GitHub.