{"record":{"id":"5f30178c9a7b910c","repo":"hyperledger/fabric","slug":"attempted-to-set-the-batch-size-preferred-max-byte-5f3017","errorCode":null,"errorMessage":"Attempted to set the batch size preferred max bytes (%v) greater than the absolute max bytes (%v).","messagePattern":"Attempted to set the batch size preferred max bytes \\((.+?)\\) greater than the absolute max bytes \\((.+?)\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/orderer.go","lineNumber":225,"sourceCode":"\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (oc *OrdererConfig) validateBatchSize() error {\n\tif oc.protos.BatchSize.MaxMessageCount == 0 {\n\t\treturn fmt.Errorf(\"Attempted to set the batch size max message count to an invalid value: 0\")\n\t}\n\tif oc.protos.BatchSize.AbsoluteMaxBytes == 0 {\n\t\treturn fmt.Errorf(\"Attempted to set the batch size absolute max bytes to an invalid value: 0\")\n\t}\n\tif oc.protos.BatchSize.PreferredMaxBytes == 0 {\n\t\treturn fmt.Errorf(\"Attempted to set the batch size preferred max bytes to an invalid value: 0\")\n\t}\n\tif oc.protos.BatchSize.PreferredMaxBytes > oc.protos.BatchSize.AbsoluteMaxBytes {\n\t\treturn fmt.Errorf(\"Attempted to set the batch size preferred max bytes (%v) greater than the absolute max bytes (%v).\", oc.protos.BatchSize.PreferredMaxBytes, oc.protos.BatchSize.AbsoluteMaxBytes)\n\t}\n\treturn nil\n}\n\nfunc (oc *OrdererConfig) validateBatchTimeout() error {\n\tvar err error\n\toc.batchTimeout, err = time.ParseDuration(oc.protos.BatchTimeout.Timeout)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Attempted to set the batch timeout to a invalid value: %s\", err)\n\t}\n\tif oc.batchTimeout <= 0 {\n\t\treturn fmt.Errorf(\"Attempted to set the batch timeout to a non-positive value: %s\", oc.batchTimeout)\n\t}\n\treturn nil\n}\n\nfunc (oc *OrdererConfig) validateAllOrgsHaveEndpoints() error {\n\tvar orgsMissingEndpoints []string","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/orderer.go#L207-L243","documentation":"Hyperledger Fabric channel configuration validates the orderer BlockSize settings when an orderer config group is created. This error means the config contains a PreferredMaxBytes value larger than AbsoluteMaxBytes, which is logically impossible: the batcher can never prefer more bytes than the absolute cap. validateBatchSize enforces both values are non-zero and that preferred <= absolute before the channel config is accepted.","triggerScenarios":"Setting Orderer.BatchSize.PreferredMaxBytes to a number greater than Orderer.BatchSize.AbsoluteMaxBytes in configtx.yaml (or via osnadmin/channel participation config update or configtxgen), then generating/validating the channel creation or update transaction.","commonSituations":"Hand-editing configtx.yaml and swapping the two values; copying a sample config where AbsoluteMaxBytes was lowered (e.g. 10 MB) while PreferredMaxBytes was raised for larger blocks; automated config templating that assigns defaults in the wrong order.","solutions":["Set Orderer.BatchSize.PreferredMaxBytes to a value <= Orderer.BatchSize.AbsoluteMaxBytes in configtx.yaml","If you intended bigger preferred batches, raise AbsoluteMaxBytes above it instead","Regenerate the genesis/config update with configtxgen after fixing the values"],"exampleFix":"# before (configtx.yaml)\nBatchSize:\n  MaxMessageCount: 500\n  AbsoluteMaxBytes: 4 MB\n  PreferredMaxBytes: 8 MB\n# after\nBatchSize:\n  MaxMessageCount: 500\n  AbsoluteMaxBytes: 10 MB\n  PreferredMaxBytes: 8 MB","handlingStrategy":"validation","validationCode":"func validateBatchSize(bs *abconfig.BatchSize) error {\n\tif bs.PreferredMaxBytes == 0 || bs.AbsoluteMaxBytes == 0 {\n\t\treturn fmt.Errorf(\"batch size values must be non-zero\")\n\t}\n\tif bs.PreferredMaxBytes > bs.AbsoluteMaxBytes {\n\t\treturn fmt.Errorf(\"PreferredMaxBytes (%d) must be <= AbsoluteMaxBytes (%d)\", bs.PreferredMaxBytes, bs.AbsoluteMaxBytes)\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if err := validateBatchSize(cfg.Orderer.BatchSize); err != nil {\n\treturn fmt.Errorf(\"invalid orderer config: %w\", err)\n}\n_, err := channelconfig.NewOrdererConfig(ordererGroup, cryptoProvider)\nif err != nil {\n\tif strings.Contains(err.Error(), \"preferred max bytes\") {\n\t\t// fix configtx BatchSize values before retrying\n\t}\n\treturn err\n}","preventionTips":["Keep AbsoluteMaxBytes >= PreferredMaxBytes in every environment's configtx.yaml","Add a CI lint/check that parses configtx.yaml and asserts BatchSize ordering","Use fabric-samples defaults as a baseline and change only one value at a time"],"tags":["hyperledger-fabric","configtx","validation","orderer"],"backgroundTag":"invalid-config-value","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"}