hyperledger/fabric · error

unknown policy type: %s

Error message

unknown policy type: %s

What it means

Default branch of AddPolicies' policy-type switch: a policy in the config profile declares a Type that is neither ImplicitMetaPolicyType nor SignaturePolicyType. Since only these two types are supported when encoding channel config, the unknown value (the %s) aborts genesis/channel config generation.

Source

Thrown at internal/configtxgen/encoder/encoder.go:125

				Policy: &cb.Policy{
					Type:  int32(cb.Policy_IMPLICIT_META),
					Value: protoutil.MarshalOrPanic(imp),
				},
			}
		case SignaturePolicyType:
			sp, err := policydsl.FromString(policy.Rule)
			if err != nil {
				return errors.Wrapf(err, "invalid signature policy rule '%s'", policy.Rule)
			}
			cg.Policies[policyName] = &cb.ConfigPolicy{
				ModPolicy: modPolicy,
				Policy: &cb.Policy{
					Type:  int32(cb.Policy_SIGNATURE),
					Value: protoutil.MarshalOrPanic(sp),
				},
			}
		default:
			return errors.Errorf("unknown policy type: %s", policy.Type)
		}
	}
	return nil
}

// NewChannelGroup defines the root of the channel configuration.  It defines basic operating principles like the hashing
// algorithm used for the blocks, as well as the location of the ordering service.  It will recursively call into the
// NewOrdererGroup, NewConsortiumsGroup, and NewApplicationGroup depending on whether these sub-elements are set in the
// configuration.  All mod_policy values are set to "Admins" for this group, with the exception of the OrdererAddresses
// value which is set to "/Channel/Orderer/Admins".
func NewChannelGroup(conf *genesisconfig.Profile) (*cb.ConfigGroup, error) {
	channelGroup := protoutil.NewConfigGroup()
	if err := AddPolicies(channelGroup, conf.Policies, channelconfig.AdminsPolicyKey); err != nil {
		return nil, errors.Wrapf(err, "error adding policies to channel group")
	}

	addValue(channelGroup, channelconfig.HashingAlgorithmValue(), channelconfig.AdminsPolicyKey)
	addValue(channelGroup, channelconfig.BlockDataHashingStructureValue(), channelconfig.AdminsPolicyKey)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Set the policy's type in the profile to ImplicitMeta or Signature, the only supported values in configtx.yaml
  2. Remove or rename the custom policy type entry; arbitrary policy types cannot be expressed via configtxgen
  3. Check for typos such as 'implicitmeta' vs 'ImplicitMeta' in the profile
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/configtxgen/encoder/encoder.go:125 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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