hyperledger/fabric · error

channelconfig Config cannot be nil

Error message

channelconfig Config cannot be nil

What it means

Returned by preValidate, the first sanity check NewBundle runs on a cb.Config before any processing. A nil config pointer means the caller passed no configuration at all; it is a programming/argument error rather than a config-content error.

Source

Thrown at common/channelconfig/bundle.go:235

	if err != nil {
		return nil, errors.Wrap(err, "initializing policymanager failed")
	}

	configtxManager, err := configtx.NewValidatorImpl(channelID, config, RootGroupKey, policyManager)
	if err != nil {
		return nil, errors.Wrap(err, "initializing configtx manager failed")
	}

	return &Bundle{
		policyManager:   policyManager,
		channelConfig:   channelConfig,
		configtxManager: configtxManager,
	}, nil
}

func preValidate(config *cb.Config) error {
	if config == nil {
		return errors.New("channelconfig Config cannot be nil")
	}

	if config.ChannelGroup == nil {
		return errors.New("config must contain a channel group")
	}

	if og, ok := config.ChannelGroup.Groups[OrdererGroupKey]; ok {
		if _, ok := og.Values[CapabilitiesKey]; !ok {
			if _, ok := config.ChannelGroup.Values[CapabilitiesKey]; ok {
				return errors.New("cannot enable channel capabilities without orderer support first")
			}

			if ag, ok := config.ChannelGroup.Groups[ApplicationGroupKey]; ok {
				if _, ok := ag.Values[CapabilitiesKey]; ok {
					return errors.New("cannot enable application capabilities without orderer support first")
				}
			}
		}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Ensure the config is extracted from a valid config envelope before calling NewBundle
  2. Add a nil check at the call site that produced the config
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at common/channelconfig/bundle.go:235 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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