hyperledger/fabric · error
failed to deserialize values
Error message
failed to deserialize values
What it means
NewConsortiumConfig builds a ConsortiumConfig from a consortium config group. It deserializes the group's proto values (ConsortiumProtos) via DeserializeProtoValuesFromGroup; if any value fails to unmarshal into the expected proto message, the error is wrapped as 'failed to deserialize values'. This guards against malformed or unexpected config values in the channel configuration.
Source
Thrown at common/channelconfig/consortium.go:39
type ConsortiumProtos struct {
ChannelCreationPolicy *cb.Policy
}
// ConsortiumConfig holds the consortium's configuration information
type ConsortiumConfig struct {
protos *ConsortiumProtos
orgs map[string]Org
}
// NewConsortiumConfig creates a new instance of the consortium's config
func NewConsortiumConfig(consortiumGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ConsortiumConfig, error) {
cc := &ConsortiumConfig{
protos: &ConsortiumProtos{},
orgs: make(map[string]Org),
}
if err := DeserializeProtoValuesFromGroup(consortiumGroup, cc.protos); err != nil {
return nil, errors.Wrap(err, "failed to deserialize values")
}
for orgName, orgGroup := range consortiumGroup.Groups {
var err error
if cc.orgs[orgName], err = NewOrganizationConfig(orgName, orgGroup, mspConfig); err != nil {
return nil, err
}
}
return cc, nil
}
// Organizations returns the set of organizations in the consortium
func (cc *ConsortiumConfig) Organizations() map[string]Org {
return cc.orgs
}
// ChannelCreationPolicy returns the policy structure used to validateView on GitHub (pinned to 2736b63f8f)
Solutions
- Inspect the wrapped underlying error (errors.Wrap preserves cause) to identify which value/key failed unmarshaling
- Regenerate the channel config transaction with the matching fabric-config / configtxlator version
- Validate the config group with configtxlator proto_decode to confirm the Consortium values are well-formed
- Ensure the same protos/fabric-protos-go version is used at config creation and consumption
Example fix
// before: swallowing cause
if err := NewConsortiumsConfig(groups, mspConfigHandler); err != nil {
return fmt.Errorf("bad consortium")
}
// after: log the wrapped cause
if err := NewConsortiumsConfig(groups, mspConfigHandler); err != nil {
return errors.Wrap(err, "consortium config rejected")
} Defensive patterns
Strategy: validation
Validate before calling
for name, v := range consortiumGroup.Values {
if v.Value == nil || len(v.Value) == 0 {
return fmt.Errorf("consortium %q: empty value %q", consortiumName, name)
}
}
// optionally pre-decode:
var p pb.Consortium
if err := proto.Unmarshal(consortiumGroup.Values["Consortium"].Value, &p); err != nil {
return fmt.Errorf("consortium value not decodable: %w", err)
} Type guard
func hasDecodableValue(g *cb.ConfigGroup, key string, m proto.Message) bool {
cv, ok := g.Values[key]
if !ok || cv.Value == nil {
return false
}
return proto.Unmarshal(cv.Value, m) == nil
} Try / catch
cc, err := NewConsortiumConfig(group, mspHandler)
if err != nil {
var cause error
errors.As(err, &cause)
log.Errorf("consortium config rejected: %v (cause: %v)", err, cause)
return err
} Prevention
- Regenerate configs with configtxgen/configtxlator of the same Fabric version you run
- Never hand-edit serialized proto values in channel config transactions
- Validate config with `configtxlator proto_decode` before submitting updates
- Keep fabric-protos-go versions aligned across tooling and peers
When it happens
Trigger: Calling NewConsortiumConfig (directly or via NewConsortiumsConfig when building a channel config) with a ConfigGroup whose Values cannot be unmarshaled into ConsortiumProtos — e.g. a value written under the wrong key, bytes corrupted, or a value created by a different/incompatible proto schema version.
Common situations: Hand-edited or tool-mangled channel config transactions; config generated by a different Fabric version whose Consortium value encoding differs; supplying a consortium group where values were never set correctly.
Related errors
- current config has consortiums section, but new config does
- failed to deserialize values
- illegal orderer config update detected: endpoints of org %s
- orderer org %s attempted to change MSP ID from %s to %s
- current config has application section, but new config does
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/a02d9c03026d6a65.
Report an issue: GitHub.