hyperledger/fabric · error

failed creating a new BFTChain

Error message

failed creating a new BFTChain

What it means

HandleChain constructs the SmartBFT chain object (chain.New/NewChain) wiring committer, WAL, metrics, BCCSP, egress comm factory and synchronizer. If any of these internal constructors fails, the error is wrapped as 'failed creating a new BFTChain' and the channel cannot start.

Source

Thrown at orderer/consensus/smartbft/consenter.go:238

		configValidator,
		uint64(selfID),
		config,
		path.Join(c.WALBaseDir, support.ChannelID()),
		c.ClusterDialer,
		c.Conf.General.Cluster,
		c.Comm,
		c.SignerSerializer,
		c.GetPolicyManager(support.ChannelID()),
		support,
		c.Metrics,
		c.MetricsBFT,
		c.MetricsWalBFT,
		c.BCCSP,
		egressCommFactory,
		&synchronizerCreator{},
	)
	if err != nil {
		return nil, errors.Wrap(err, "failed creating a new BFTChain")
	}

	// refresh cluster service with updated consenters
	c.ClusterService.ConfigureNodeCerts(chain.Channel, consenters)
	chain.ClusterService = c.ClusterService

	return chain, nil
}

func (c *Consenter) IsChannelMember(joinBlock *cb.Block) (bool, error) {
	if joinBlock == nil {
		return false, errors.New("nil block")
	}
	envelopeConfig, err := protoutil.ExtractEnvelope(joinBlock, 0)
	if err != nil {
		return false, err
	}
	bundle, err := channelconfig.NewBundleFromEnvelope(envelopeConfig, c.BCCSP)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Check the wrapped inner error in the orderer log for the root cause
  2. Fix filesystem permissions on the orderer's ledger/WAL directory (FileLedger location) and ensure it is writable and not full
  3. If the WAL is corrupted, stop the orderer and remove/rebuild the channel's WAL data (or restore the orderer from backup) — ledger data itself may need rejoin via osnadmin
  4. After a version upgrade, verify WAL compatibility or rejoin the node to the channel with the latest config block
Defensive patterns

Strategy: try-catch

Validate before calling

// Check prerequisites before starting the chain
if err := checkDirWritable(ledgerPath + "/chains/" + channelID); err != nil {
    return fmt.Errorf("WAL/ledger path not writable: %w", err)
}

Try / catch

chain, err := newChain(...)
if err != nil {
    if strings.Contains(err.Error(), "WAL") || errors.Is(err, os.ErrPermission) {
        // storage problem: fix permissions/disk, optionally rebuild WAL from ledger
        return repairStorageAndRejoin(channelID)
    }
    return fmt.Errorf("failed creating a new BFTChain: %w", err)
}

Prevention

When it happens

Trigger: NewChain returns an error — typically from WAL creation (unwritable/partially corrupted WAL directory under FileLedger/WAL location), crypto/BCCSP setup, or runtime resource initialization for the channel.

Common situations: Disk permission problems or corrupted write-ahead log from an unclean shutdown; ledger data directory migrated or mounted read-only; resource exhaustion preventing goroutine/timer allocation; fabric upgrade leaving WAL entries from an incompatible version.

Related errors


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