{"record":{"id":"ec6ef6005d66c12c","repo":"hyperledger/fabric","slug":"consenter-options-read-failed-with-error-s-for-or","errorCode":null,"errorMessage":"consenter options read failed with error %s for orderer type %s","messagePattern":"consenter options read failed with error (.+?) for orderer type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configtxgen/encoder/encoder.go","lineNumber":225,"sourceCode":"\t}\n\n\tvar consensusMetadata []byte\n\tvar err error\n\n\tswitch conf.OrdererType {\n\tcase ConsensusTypeSolo:\n\tcase ConsensusTypeEtcdRaft:\n\t\tif consensusMetadata, err = channelconfig.MarshalEtcdRaftMetadata(conf.EtcdRaft); err != nil {\n\t\t\treturn nil, errors.Errorf(\"cannot marshal metadata for orderer type %s: %s\", ConsensusTypeEtcdRaft, err)\n\t\t}\n\tcase ConsensusTypeBFT:\n\t\tconsenterProtos, err := consenterProtosFromConfig(conf.ConsenterMapping)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Errorf(\"cannot load consenter config for orderer type %s: %s\", ConsensusTypeBFT, err)\n\t\t}\n\t\taddValue(ordererGroup, channelconfig.OrderersValue(consenterProtos), channelconfig.AdminsPolicyKey)\n\t\tif consensusMetadata, err = channelconfig.MarshalBFTOptions(conf.SmartBFT); err != nil {\n\t\t\treturn nil, errors.Errorf(\"consenter options read failed with error %s for orderer type %s\", err, ConsensusTypeBFT)\n\t\t}\n\t\t// Force leader rotation to be turned off\n\t\tconf.SmartBFT.LeaderRotation = smartbft.Options_ROTATION_OFF\n\t\t// Overwrite policy manually by computing it from the consenters\n\t\tpolicies.EncodeBFTBlockVerificationPolicy(consenterProtos, ordererGroup)\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unknown orderer type: %s\", conf.OrdererType)\n\t}\n\n\taddValue(ordererGroup, channelconfig.ConsensusTypeValue(conf.OrdererType, consensusMetadata), channelconfig.AdminsPolicyKey)\n\n\tfor _, org := range conf.Organizations {\n\t\tvar err error\n\t\tordererGroup.Groups[org.Name], err = NewOrdererOrgGroup(org, channelCapabilities)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create orderer org\")\n\t\t}\n\t}","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/configtxgen/encoder/encoder.go#L207-L243","documentation":"For BFT orderers, after loading consenters the encoder marshals conf.SmartBFT (the smartbft.Options proto) into consensus metadata via channelconfig.MarshalBFTOptions. If those options are invalid or cannot be serialized, NewOrdererGroup returns this message embedding the marshal error and the BFT orderer type.","triggerScenarios":"NewOrdererGroup/NewChannelGroup with OrdererType \"BFT\" where MarshalBFTOptions(conf.SmartBFT) fails — e.g. malformed/missing SmartBFT fields in configtx.yaml (request batch timeouts, leader rotation settings, incorrect numeric values).","commonSituations":"Hand-editing the SmartBFT section with wrong field names/types, leaving required options unset, or reusing an etcdraft profile body under a BFT OrdererType.","solutions":["Read the embedded error after 'error' — it identifies which SmartBFT option failed","Compare your SmartBFT block against the Fabric BFT sample configtx.yaml and fix field names/values","If options are set programmatically, validate the smartbft.Options proto before calling the encoder","Regenerate the genesis/channel config once options are corrected"],"exampleFix":"# before\nSmartBFT:\n    RequestBatchMaxCount: \"not-a-number\"\n# after\nSmartBFT:\n    RequestBatchMaxCount: 100\n    RequestBatchMaxInterval: 50ms\n    LeaderRotation: 0","handlingStrategy":"validation","validationCode":"func validateSmartBFTOptions(opts *smartbft.Options) error {\n    if opts == nil { return errors.New(\"SmartBFT options required for BFT orderer\") }\n    if opts.RequestBatchMaxCount <= 0 { return errors.New(\"RequestBatchMaxCount must be positive\") }\n    return nil\n}","typeGuard":"func hasSmartBFT(conf *genesisconfig.Orderer) bool { return conf.OrdererType == \"BFT\" && conf.SmartBFT != nil }","tryCatchPattern":"group, err := encoder.NewOrdererGroup(conf, caps)\nif err != nil && strings.Contains(err.Error(), \"consenter options read failed\") {\n    return fmt.Errorf(\"fix SmartBFT options block in configtx.yaml: %w\", err)\n}","preventionTips":["Copy the SmartBFT block verbatim from the Fabric BFT sample configtx.yaml","Never reuse an etcdraft options block under OrdererType: BFT","Keep numeric/time fields in the exact formats the sample uses (e.g. 50ms)"],"tags":["config","hyperledger-fabric","bft"],"backgroundTag":"consensus-metadata-marshal-failed","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"}