{"record":{"id":"e01d4b54341da394","repo":"hyperledger/fabric","slug":"invalid-options-encoded-in-consensus-metadata-v","errorCode":null,"errorMessage":"invalid options encoded in consensus metadata: %v","messagePattern":"invalid options encoded in consensus metadata: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/smartbft/configverifier.go","lineNumber":182,"sourceCode":"\n\tif !proto.Equal(expectedConfigPol, actualPolicy) {\n\t\treturn fmt.Errorf(\"block validation policy should be a signature policy: %v but it is %v instead\", expectedConfigPol, actualPolicy)\n\t}\n\n\tconsensusTypeConfigValue := conf.ChannelGroup.Groups[\"Orderer\"].Values[\"ConsensusType\"]\n\n\tif consensusTypeConfigValue == nil {\n\t\treturn fmt.Errorf(\"missing consensus type property in config\")\n\t}\n\n\tconsensusTypeValue := &protosorderer.ConsensusType{}\n\tif err := proto.Unmarshal(consensusTypeConfigValue.Value, consensusTypeValue); err != nil {\n\t\treturn fmt.Errorf(\"invalid consensus type property in config: %v\", err)\n\t}\n\n\tconfigOptions := &smartbft.Options{}\n\tif err := proto.Unmarshal(consensusTypeValue.Metadata, configOptions); err != nil {\n\t\treturn fmt.Errorf(\"invalid options encoded in consensus metadata: %v\", err)\n\t}\n\n\tif configOptions.LeaderRotation == smartbft.Options_ROTATION_ON {\n\t\treturn fmt.Errorf(\"leader rotation must be turned off for this version or be unspecified\")\n\t}\n\n\treturn nil\n}\n\nfunc (cbv *ConfigBlockValidator) verifyConfigUpdateMsg(outEnv *common.Envelope, confEnv *common.ConfigEnvelope, chdr *common.ChannelHeader) error {\n\tif confEnv == nil || confEnv.LastUpdate == nil || confEnv.Config == nil {\n\t\treturn errors.New(\"invalid config envelope\")\n\t}\n\tenvPayload, err := protoutil.UnmarshalPayload(confEnv.LastUpdate.Payload)\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/configverifier.go#L164-L200","documentation":"The ConsensusType value unmarshaled fine, but its Metadata must itself unmarshal into a smartbft.Options protobuf. A malformed Metadata blob means the BFT options (ticks, timeouts, leader rotation, etc.) cannot be read, so the update is rejected.","triggerScenarios":"proto.Unmarshal(consensusTypeValue.Metadata, configOptions) fails in checkConsentersMatchPolicy — Metadata bytes are empty-but-non-nil garbage, wrong message type, or corrupted.","commonSituations":"Consenter metadata assembled by custom tooling using the wrong proto; hand-edited consensus metadata; ordering-node versions writing incompatible Options fields; copying metadata from an etcdraft channel into a BFT channel.","solutions":["Marshal Metadata from a correct &smartbft.Options{} message and store it in ConsensusType.Metadata","Use configtxgen / the SmartBFT sample config to produce consensusMetadata instead of hand-writing bytes","Decode the raw metadata with protoc --decode_raw to diagnose the wrong content"],"exampleFix":"// before\nmetadata, _ := proto.Marshal(&etcdraft.Metadata{Consenters: consenters}) // wrong proto type for BFT\n// after\nmetadata, _ := proto.Marshal(&smartbft.Options{DecisionTimeout: 500, LeaderRotation: smartbft.Options_ROTATION_OFF})","handlingStrategy":"validation","validationCode":"opts := &smartbft.Options{}\nif err := proto.Unmarshal(consensusTypeValue.Metadata, opts); err != nil {\n    return fmt.Errorf(\"consensus metadata is not valid smartbft.Options: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := verifyMetadata(consensusTypeValue.Metadata); err != nil {\n    return fmt.Errorf(\"aborting config submission: %w\", err)\n}","preventionTips":["Build BFT metadata only from smartbft.Options / etcdraft consenters marshaled by the matching Fabric version","Decode existing metadata with protoc --decode_raw before modifying","Do not copy etcdraft Metadata into BFT channels"],"tags":["hyperledger-fabric","smartbft","protobuf","consensus-metadata"],"backgroundTag":"protobuf-unmarshal-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"}