hyperledger/fabric · error
failed to deserialize values
Error message
failed to deserialize values
What it means
When building an OrdererOrgConfig from a config group, Fabric deserializes the group's value protobufs (e.g. OrdererAddresses Endpoints, plus organization protos like MSP). If any value in the Orderer org's ConfigGroup cannot be unmarshaled into its expected protobuf type, the error is wrapped as 'failed to deserialize values'. This indicates the channel configuration transaction/block contains malformed or unexpected bytes in the orderer org group.
Source
Thrown at common/channelconfig/orderer.go:102
}
// NewOrdererOrgConfig returns an orderer org config built from the given ConfigGroup.
func NewOrdererOrgConfig(orgName string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*OrdererOrgConfig, error) {
if len(orgGroup.Groups) > 0 {
return nil, fmt.Errorf("OrdererOrg config does not allow sub-groups")
}
if !channelCapabilities.OrgSpecificOrdererEndpoints() {
if _, ok := orgGroup.Values[EndpointsKey]; ok {
return nil, errors.Errorf("Orderer Org %s cannot contain endpoints value until V1_4_2+ capabilities have been enabled", orgName)
}
}
protos := &OrdererOrgProtos{}
orgProtos := &OrganizationProtos{}
if err := DeserializeProtoValuesFromGroup(orgGroup, protos, orgProtos); err != nil {
return nil, errors.Wrap(err, "failed to deserialize values")
}
ooc := &OrdererOrgConfig{
name: orgName,
protos: protos,
OrganizationConfig: &OrganizationConfig{
name: orgName,
protos: orgProtos,
mspConfigHandler: mspConfigHandler,
},
}
if err := ooc.Validate(); err != nil {
return nil, err
}
return ooc, nil
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Regenerate the channel configuration with configtxgen or the configtxlator instead of hand-crafting ConfigGroup values, ensuring each value is marshaled from the exact expected proto (e.g. cb.OrdererAddresses for Endpoints).
- Use configtxlator proto_decode/encode round-trips to inspect the offending orderer org group value and fix its message type or bytes.
- If the error comes from a config block, verify block integrity — re-fetch the block from the ordering service rather than a local modified copy.
- Check that no value keys are present that map to protos with the wrong wire format for your Fabric version.
Example fix
// before: wrong proto type for Endpoints value
addrs := &cb.Orderers{Orderers: []string{"orderer.example.com:7050"}}
valBytes, _ := proto.Marshal(addrs)
group.Values["Endpoints"] = &cb.ConfigValue{Value: valBytes}
// after: correct proto type
addrs := &cb.OrdererAddresses{Addresses: []string{"orderer.example.com:7050"}}
valBytes, _ := proto.Marshal(addrs)
group.Values["Endpoints"] = &cb.ConfigValue{Value: valBytes} Defensive patterns
Strategy: validation
Validate before calling
func validateOrdererOrgGroup(orgGroup *cb.ConfigGroup) error {
for key, val := range orgGroup.Values {
switch key {
case "Endpoints":
var m cb.OrdererAddresses
if err := proto.Unmarshal(val.Value, &m); err != nil {
return fmt.Errorf("orderer org value %q is not a valid OrdererAddresses: %w", key, err)
}
}
}
return nil
} Type guard
func isMarshalableValue(msg proto.Message) bool {
_, err := proto.Marshal(msg)
return err == nil
} Try / catch
ooc, err := channelconfig.NewOrdererOrgConfig(orgName, orgGroup, mspHandler, caps)
if err != nil {
if strings.Contains(err.Error(), "failed to deserialize values") {
return fmt.Errorf("orderer org %q config group contains malformed proto values; re-generate config with configtxgen: %w", orgName, err)
}
return err
} Prevention
- Always generate or modify channel config through configtxgen/configtxlator, never hand-craft proto bytes.
- Marshaled value types must match the exact proto expected by the key (e.g. cb.OrdererAddresses for Endpoints).
- Round-trip decode any modified config with configtxlator to confirm values still parse.
- Enable V1_4_2+ channel capabilities before adding org-specific Endpoints values.
When it happens
Trigger: Calling NewOrdererOrgConfig (directly or via NewOrdererConfig/NewChannelConfig) with a cb.ConfigGroup whose Values contain entries that fail DeserializeProtoValuesFromGroup — e.g. an Endpoints value whose marshaled bytes are not a valid common.OrdererAddresses message, a value keyed under a known proto name but holding a different message type, or corrupted bytes in a config block being replayed.
Common situations: Hand-edited or programmatically generated channel config where a value was marshaled with the wrong proto type; config blocks copied between networks/channels and modified with byte-level corruption; third-party tooling writing configtx updates with mismatched value types; upgrading across Fabric versions where a value's expected proto changed.
Related errors
- failed to deserialize values
- failed parsing request
- Failed unmarshalling GossipMessage from envelope: %v
- Cannot read channels list response, %s
- channel header unmarshalling error: %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/457ca65d7227b3d0.
Report an issue: GitHub.