{"record":{"id":"3313700346c5862f","repo":"hyperledger/fabric","slug":"attempted-to-set-the-batch-timeout-to-a-invalid-va","errorCode":null,"errorMessage":"Attempted to set the batch timeout to a invalid value: %s","messagePattern":"Attempted to set the batch timeout to a invalid value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/orderer.go","lineNumber":234,"sourceCode":"\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\n\n\tfor _, org := range oc.Organizations() {\n\t\tif len(org.Endpoints()) == 0 {\n\t\t\torgsMissingEndpoints = append(orgsMissingEndpoints, org.Name())\n\t\t}\n\t}\n\n\tif len(orgsMissingEndpoints) > 0 {\n\t\treturn errors.Errorf(\"some orderer organizations endpoints are empty: %s\", orgsMissingEndpoints)","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/orderer.go#L216-L252","documentation":"validateBatchTimeout parses Orderer.BatchTimeout.Timeout with time.ParseDuration. If the string is not a valid Go duration (e.g. missing a unit), ParseDuration fails and this error wraps the parse error, rejecting the orderer channel config.","triggerScenarios":"BatchTimeout value in configtx.yaml like \"2\" (no unit), \"2m30\" (partial unit), or empty string, passed through configtxgen / channel config creation.","commonSituations":"Typos in configtx.yaml; writing a plain integer seconds value assuming implicit seconds; templating tools that emit empty BatchTimeout when a variable is unset; YAML quoting issues that stringify a map instead of a duration string.","solutions":["Fix BatchTimeout in configtx.yaml to a valid Go duration with unit, e.g. \"2s\"","Do not use bare numbers; always include s/m/h suffix","Rerun configtxgen and recreate/update the channel config"],"exampleFix":"# before (configtx.yaml)\nBatchTimeout: 2\n# after\nBatchTimeout: 2s","handlingStrategy":"validation","validationCode":"func validDuration(s string) error {\n\t_, err := time.ParseDuration(s)\n\treturn err\n}\nif err := validDuration(cfg.Orderer.BatchTimeout); err != nil {\n\treturn fmt.Errorf(\"BatchTimeout must be a Go duration like \\\"2s\\\": %w\", err)\n}","typeGuard":null,"tryCatchPattern":"_, err := channelconfig.NewOrdererConfig(ordererGroup, cryptoProvider)\nif err != nil && strings.Contains(err.Error(), \"batch timeout to a invalid value\") {\n\treturn fmt.Errorf(\"fix BatchTimeout in configtx.yaml to include a unit (e.g. \\\"2s\\\"): %w\", err)\n}","preventionTips":["Always include a unit suffix (s, m, h) in BatchTimeout values","Never quote-free bare integers for durations in configtx.yaml","Validate generated configs with configtxgen in CI before deploying"],"tags":["hyperledger-fabric","configtx","duration-parsing","orderer"],"backgroundTag":"invalid-duration-format","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"}