hyperledger/fabric · error

refusing to generate block which is missing orderer section

Error message

refusing to generate block which is missing orderer section

What it means

doOutputBlock creates a bootstrapper from the profile config and refuses to generate a genesis block when config.Orderer is nil, since a channel genesis block cannot be encoded without an orderer system-chain group. Fabric v3.x removed system-channel support, so the orderer section must still be present and correctly defined in the configtx profile.

Source

Thrown at cmd/configtxgen/main.go:38

	"github.com/hyperledger/fabric-lib-go/common/flogging"
	cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
	"github.com/hyperledger/fabric/internal/configtxgen/encoder"
	"github.com/hyperledger/fabric/internal/configtxgen/genesisconfig"
	"github.com/hyperledger/fabric/internal/configtxgen/metadata"
	"github.com/hyperledger/fabric/protoutil"
	"github.com/pkg/errors"
)

var logger = flogging.MustGetLogger("common.tools.configtxgen")

func doOutputBlock(config *genesisconfig.Profile, channelID string, outputBlock string) error {
	pgen, err := encoder.NewBootstrapper(config)
	if err != nil {
		return errors.WithMessage(err, "could not create bootstrapper")
	}
	logger.Info("Generating genesis block")
	if config.Orderer == nil {
		return errors.New("refusing to generate block which is missing orderer section")
	}
	if config.Consortiums != nil {
		logger.Error("Warning: 'Consortiums' should be nil since system channel is no longer supported in Fabric v3.x")
	} else {
		if config.Application == nil {
			return errors.New("refusing to generate application channel block which is missing application section")
		}
		logger.Info("Creating application channel genesis block")
	}
	genesisBlock := pgen.GenesisBlockForChannel(channelID)
	logger.Info("Writing genesis block")
	err = writeFile(outputBlock, protoutil.MarshalOrPanic(genesisBlock), 0o640)
	if err != nil {
		return fmt.Errorf("error writing genesis block: %s", err)
	}
	return nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Add a complete Orderer section (OrdererType, Addresses, Organizations etc.) to the profile used with -profile
  2. Verify the -profile flag names an existing profile that includes orderer config
  3. Ensure the referenced organization exists under Organizations and is listed in Orderer.Organizations
  4. Compare against the sample configtx.yaml from the Fabric version in use

Example fix

# before (configtx.yaml profile)
TwoOrgsChannel:
  Consortium: SampleConsortium
  Application: ...
# after
TwoOrgsChannel:
  Orderer:
    OrdererType: etcdraft
    Addresses: [orderer.example.com:7050]
    Organizations: [OrdererOrg]
  Consortium: SampleConsortium
  Application: ...
Defensive patterns

Strategy: validation

Validate before calling

cfg, err := configtxlan.Load(profilePath)
if err != nil { return err }
p := cfg.Profiles[profileName]
if p == nil || p.Orderer == nil {
    return fmt.Errorf("profile %s missing Orderer section", profileName)
}

Try / catch

if err := doOutputBlock(...); err != nil {
    if strings.Contains(err.Error(), "missing orderer section") {
        return fmt.Errorf("add Orderer section to profile %s in configtx.yaml", profileName)
    }
    return err
}

Prevention

When it happens

Trigger: Running `configtxgen -outputBlock` with a configtx.yaml profile lacking the Orderer section (or Orderer: nil when constructing config programmatically); profile typo so the selected profile has no orderer config.

Common situations: Creating an application channel profile without copying the Orderer section; hand-trimmed configtx.yaml after removing the system channel; referencing the wrong profile name; upgrading to Fabric v3.x and dropping orderer config from profiles.

Related errors


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