hyperledger/fabric · error
error marshalling default instantiation policy
Error message
error marshalling default instantiation policy
What it means
GetInstantiationPolicy builds a default instantiation policy (SignedByAnyAdmin of the channel's MSP IDs) and marshals it to protobuf bytes. This error is returned if protoutil.Marshal fails on that generated policy object. In practice it almost never fires because the policy is constructed internally, but it guards against serialization failures.
Source
Thrown at core/scc/lscc/support.go:66
func (s *SupportImpl) GetInstantiationPolicy(channel string, ccpack ccprovider.CCPackage) ([]byte, error) {
var ip []byte
var err error
// if ccpack is a SignedCDSPackage, return its IP, otherwise use a default IP
sccpack, isSccpack := ccpack.(*ccprovider.SignedCDSPackage)
if isSccpack {
ip = sccpack.GetInstantiationPolicy()
if ip == nil {
return nil, errors.Errorf("instantiation policy cannot be nil for a SignedCCDeploymentSpec")
}
} else {
// the default instantiation policy allows any of the channel MSP admins
// to be able to instantiate
mspids := s.GetMSPIDs(channel)
p := policydsl.SignedByAnyAdmin(mspids)
ip, err = protoutil.Marshal(p)
if err != nil {
return nil, errors.Errorf("error marshalling default instantiation policy")
}
}
return ip, nil
}
// CheckInstantiationPolicy checks whether the supplied signed proposal
// complies with the supplied instantiation policy
func (s *SupportImpl) CheckInstantiationPolicy(signedProp *pb.SignedProposal, chainName string, instantiationPolicy []byte) error {
// create a policy object from the policy bytes
idd := s.GetIdentityDeserializer(chainName)
if idd == nil {
return errors.Errorf("error checking chaincode instantiation policy: MSP manager for channel %s not found", chainName)
}
npp := cauthdsl.NewPolicyProvider(idd)
instPol, _, err := npp.NewPolicy(instantiationPolicy)
if err != nil {
return err
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Retry the chaincode install/instantiate operation; the failure is usually transient or internal
- Verify channel MSP configuration is valid (mspids list is well-formed)
- Update to a patched Fabric version if the marshal error is reproducible
Defensive patterns
Strategy: retry
Validate before calling
// ensure channel MSP IDs are available before defaulting to implicit policy
if len(s.GetMSPIDs(channel)) == 0 {
return nil, errors.Errorf("no MSP IDs found for channel %s", channel)
} Try / catch
ip, err := support.GetInstantiationPolicy(channel, ccdata)
if err != nil {
return fmt.Errorf("failed to get instantiation policy: %w", err)
} Prevention
- Ensure channel MSP configuration is valid before deploy
- Retry transient marshal failures
- Keep Fabric version current to avoid internal serialization bugs
When it happens
Trigger: Calling GetInstantiationPolicy for a chaincode with no explicit instantiation policy, when the internally generated SignedByAnyAdmin policy cannot be marshalled (e.g. corrupted MSP IDs list or internal protobuf issue).
Common situations: Rare; seen during chaincode install/instantiate flows on channels whose MSP configuration is anomalous, or in forked/patched builds where policy types changed.
Related errors
- proto: Marshal called with nil
- must be pointer to struct, but got non-pointer %v
- must be pointers to struct, but got pointer to %v
- unsupported slice type %v for field %s
- unsupported pointer type %v for field %s (must be proto)
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/c133d9b6976d458e.
Report an issue: GitHub.