hyperledger/fabric · error

failed unmarshalling orderer addresses

Error message

failed unmarshalling orderer addresses

What it means

When assembling the config result, discovery reads the channel-level OrdererAddresses value from the config and unmarshals it as common.OrdererAddresses. If those raw bytes don't parse as that protobuf message, the config data itself is corrupt or of an unexpected type, and the query fails with this wrapped error.

Source

Thrown at discovery/support/config/support.go:76

	}

	if err := ValidateConfig(config); err != nil {
		return nil, errors.WithMessage(err, "config is invalid")
	}

	res := &discovery.ConfigResult{
		Msps:     make(map[string]*msp.FabricMSPConfig),
		Orderers: make(map[string]*discovery.Endpoints),
	}
	ordererGrp := config.ChannelGroup.Groups[channelconfig.OrdererGroupKey].Groups
	appGrp := config.ChannelGroup.Groups[channelconfig.ApplicationGroupKey].Groups

	var globalEndpoints []string
	globalOrderers := config.ChannelGroup.Values[channelconfig.OrdererAddressesKey]
	if globalOrderers != nil {
		ordererAddressesConfig := &common.OrdererAddresses{}
		if err := proto.Unmarshal(globalOrderers.Value, ordererAddressesConfig); err != nil {
			return nil, errors.Wrap(err, "failed unmarshalling orderer addresses")
		}
		globalEndpoints = ordererAddressesConfig.Addresses
	}

	ordererEndpoints, err := computeOrdererEndpoints(ordererGrp, globalEndpoints)
	if err != nil {
		return nil, errors.Wrap(err, "failed computing orderer addresses")
	}
	res.Orderers = ordererEndpoints

	if err := appendMSPConfigs(ordererGrp, appGrp, res.Msps); err != nil {
		return nil, errors.WithStack(err)
	}
	return res, nil
}

func computeOrdererEndpoints(ordererGrp map[string]*common.ConfigGroup, globalOrdererAddresses []string) (map[string]*discovery.Endpoints, error) {
	endpointsByMSPID, err := perOrgEndpointsByMSPID(ordererGrp)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Inspect and repair the channel configuration so OrdererAddresses is a valid common.OrdererAddresses protobuf
  2. Regenerate the channel config from configtx.yaml and apply a proper config update
  3. Restore the peer's ledger/config from a good backup if the stored config is corrupted
Defensive patterns

Strategy: try-catch

Validate before calling

oa := &common.OrdererAddresses{}
if err := proto.Unmarshal(globalOrderersValue, oa); err != nil {
    return fmt.Errorf("channel config orderer addresses corrupt: %w", err)
}

Try / catch

res, err := client.Send(ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "failed unmarshalling orderer addresses") {
        // channel config data corrupt — repair via config update
    }
    return err
}

Prevention

When it happens

Trigger: config.ChannelGroup.Values[channelconfig.OrdererAddressesKey] holds bytes that fail proto.Unmarshal into &common.OrdererAddresses{} — e.g. hand-edited or malformed channel configuration.

Common situations: Manually patched channel config blocks; config produced by non-standard tooling; corrupted ledger config data after a failed config update transaction.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


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