{"record":{"id":"19117298780ad303","repo":"hyperledger/fabric","slug":"unsupported-policy-type-t-on-channel-s","errorCode":null,"errorMessage":"unsupported policy type %T on channel '%s'","messagePattern":"unsupported policy type %T on channel '(.+?)'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/chaincode/lifecycle/metadata_provider.go","lineNumber":104,"sourceCode":"\t\tp, err := mp.ChannelPolicyReferenceProvider.NewPolicy(channelID, policy.ChannelConfigPolicyReference)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessagef(err, \"could not retrieve policy for reference '%s' on channel '%s'\", policy.ChannelConfigPolicyReference, channelID)\n\t\t}\n\n\t\tcp, ok := p.(policies.Converter)\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"policy with reference '%s' on channel '%s' is not convertible to SignaturePolicyEnvelope\", policy.ChannelConfigPolicyReference, channelID)\n\t\t}\n\n\t\tspe, err := cp.Convert()\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessagef(err, \"error converting policy with reference '%s' on channel '%s' to SignaturePolicyEnvelope\", policy.ChannelConfigPolicyReference, channelID)\n\t\t}\n\n\t\treturn proto.Marshal(spe)\n\tdefault:\n\t\t// this will only happen if a new policy type is added to the oneof\n\t\treturn nil, errors.Errorf(\"unsupported policy type %T on channel '%s'\", policy, channelID)\n\t}\n}\n\n// Metadata implements the metadata retriever support interface for service discovery\nfunc (mp *MetadataProvider) Metadata(channel string, ccName string, collections ...string) *chaincode.Metadata {\n\tccInfo, err := mp.ChaincodeInfoProvider.ChaincodeInfo(channel, ccName)\n\tif err != nil {\n\t\tlogger.Debugf(\"chaincode '%s' on channel '%s' not defined in _lifecycle. requesting metadata from lscc\", ccName, channel)\n\t\t// fallback to legacy metadata via cclifecycle\n\t\treturn mp.LegacyMetadataProvider.Metadata(channel, ccName, collections...)\n\t}\n\n\tspe, err := mp.toSignaturePolicyEnvelope(channel, ccInfo.Definition.ValidationInfo.ValidationParameter)\n\tif err != nil {\n\t\tlogger.Errorf(\"could not convert policy for chaincode '%s' on channel '%s', err '%s'\", ccName, channel, err)\n\t\treturn nil\n\t}\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/chaincode/lifecycle/metadata_provider.go#L86-L122","documentation":"The ApplicationPolicy oneof has a default case reached only if a policy type not handled (SignaturePolicy or ChannelConfigPolicyReference) appears — normally only when a new policy type is added to the protobuf oneof while the running peer predates it. The peer cannot interpret the policy type and throws this error with the Go type name.","triggerScenarios":"Metadata calls toSignaturePolicyEnvelope with an ApplicationPolicy whose Type oneof holds an unknown/newer policy type — e.g. a peer on an older Fabric version receiving state or definitions produced by a newer version introducing a new policy type.","commonSituations":"Rolling upgrade where newer peers/CLIs write new policy types that older peers cannot parse; custom forks adding policy types; state copied between incompatible Fabric versions.","solutions":["Upgrade all peers to a Fabric version that supports the policy type in use","Re-define the endorsement policy using a supported type (signature policy or channel config reference)","Avoid copying peer state across incompatible Fabric versions","Check for mixed-version peers in the org during upgrades"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Before upgrade, verify no peer runs a version older than the network's\n# minimum supported Fabric version that understands the policy types in use.\n# On each peer:\npeer version | grep -E 'Version'","typeGuard":null,"tryCatchPattern":"envBytes, err := mp.toSignaturePolicyEnvelope(channelID, policyBytes)\nif err != nil {\n  if strings.Contains(err.Error(), \"unsupported policy type\") {\n    // upgrade this peer before retrying\n  }\n}","preventionTips":["Upgrade all peers before using new policy types","Never copy state between incompatible Fabric versions","Avoid custom forks introducing new protobuf policy types","Include version checks in deployment runbooks"],"tags":["fabric","policy","version-mismatch","unsupported-type"],"backgroundTag":"unsupported-policy-type","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"}