hyperledger/fabric · error

bad config metadata option ViewChangeTimeout

Error message

bad config metadata option ViewChangeTimeout

What it means

ConfigFromMetadataOptions parses ViewChangeTimeout from the BFT consensus metadata options via time.ParseDuration and wraps any failure with this message. An invalid ViewChangeTimeout means the view-change timing in the metadata cannot be turned into a time.Duration, so the config block is rejected and the BFT chain cannot be created or updated.

Source

Thrown at orderer/consensus/smartbft/util/util.go:47

	if config.RequestBatchMaxInterval, err = time.ParseDuration(options.RequestBatchMaxInterval); err != nil {
		return config, errors.Wrap(err, "bad config metadata option RequestBatchMaxInterval")
	}
	config.IncomingMessageBufferSize = options.IncomingMessageBufferSize
	config.RequestPoolSize = options.RequestPoolSize
	if config.RequestForwardTimeout, err = time.ParseDuration(options.RequestForwardTimeout); err != nil {
		return config, errors.Wrap(err, "bad config metadata option RequestForwardTimeout")
	}
	if config.RequestComplainTimeout, err = time.ParseDuration(options.RequestComplainTimeout); err != nil {
		return config, errors.Wrap(err, "bad config metadata option RequestComplainTimeout")
	}
	if config.RequestAutoRemoveTimeout, err = time.ParseDuration(options.RequestAutoRemoveTimeout); err != nil {
		return config, errors.Wrap(err, "bad config metadata option RequestAutoRemoveTimeout")
	}
	if config.ViewChangeResendInterval, err = time.ParseDuration(options.ViewChangeResendInterval); err != nil {
		return config, errors.Wrap(err, "bad config metadata option ViewChangeResendInterval")
	}
	if config.ViewChangeTimeout, err = time.ParseDuration(options.ViewChangeTimeout); err != nil {
		return config, errors.Wrap(err, "bad config metadata option ViewChangeTimeout")
	}
	if config.LeaderHeartbeatTimeout, err = time.ParseDuration(options.LeaderHeartbeatTimeout); err != nil {
		return config, errors.Wrap(err, "bad config metadata option LeaderHeartbeatTimeout")
	}
	config.LeaderHeartbeatCount = options.LeaderHeartbeatCount
	if config.CollectTimeout, err = time.ParseDuration(options.CollectTimeout); err != nil {
		return config, errors.Wrap(err, "bad config metadata option CollectTimeout")
	}
	config.SyncOnStart = options.SyncOnStart
	config.SpeedUpViewChange = options.SpeedUpViewChange

	if options.LeaderRotation != smartbft.Options_ROTATION_ON {
		config.LeaderRotation = false
		config.DecisionsPerLeader = 0
	} else {
		config.LeaderRotation = true
		config.DecisionsPerLeader = options.DecisionsPerLeader
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Set ViewChangeTimeout to a valid duration string such as "20s" in the consensus metadata
  2. Regenerate the channel config block with correct options and recommit it
  3. Use `inspect` on the config block to validate all BFT metadata options before committing
  4. Check for typos/missing time units; Go durations require units (ns/us/ms/s/m/h)

Example fix

// before
"ViewChangeTimeout": "20"
// after
"ViewChangeTimeout": "20s"
Defensive patterns

Strategy: validation

Validate before calling

if _, err := time.ParseDuration(opts.ViewChangeTimeout); err != nil { return fmt.Errorf("ViewChangeTimeout invalid: %w", err) }

Try / catch

cfg, err := util.ConfigFromMetadataOptions(selfID, opts)
if err != nil { return fmt.Errorf("rejecting options: %w", err) }

Prevention

When it happens

Trigger: Orderer start, channel config commit (configBlockToBFTConfig), or `inspect` when options.ViewChangeTimeout is empty or malformed (e.g. missing unit like '500', '5m30' with typo).

Common situations: Mistyped duration when customizing timeouts, config produced by a script that serializes milliseconds as an integer, or partially migrated metadata from an older Fabric version.

Understand the failure class

Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.

Related errors


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