{"record":{"id":"a02d9c03026d6a65","repo":"hyperledger/fabric","slug":"failed-to-deserialize-values-a02d9c","errorCode":null,"errorMessage":"failed to deserialize values","messagePattern":"failed to deserialize values","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/consortium.go","lineNumber":39,"sourceCode":"type ConsortiumProtos struct {\n\tChannelCreationPolicy *cb.Policy\n}\n\n// ConsortiumConfig holds the consortium's configuration information\ntype ConsortiumConfig struct {\n\tprotos *ConsortiumProtos\n\torgs   map[string]Org\n}\n\n// NewConsortiumConfig creates a new instance of the consortium's config\nfunc NewConsortiumConfig(consortiumGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ConsortiumConfig, error) {\n\tcc := &ConsortiumConfig{\n\t\tprotos: &ConsortiumProtos{},\n\t\torgs:   make(map[string]Org),\n\t}\n\n\tif err := DeserializeProtoValuesFromGroup(consortiumGroup, cc.protos); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to deserialize values\")\n\t}\n\n\tfor orgName, orgGroup := range consortiumGroup.Groups {\n\t\tvar err error\n\t\tif cc.orgs[orgName], err = NewOrganizationConfig(orgName, orgGroup, mspConfig); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn cc, nil\n}\n\n// Organizations returns the set of organizations in the consortium\nfunc (cc *ConsortiumConfig) Organizations() map[string]Org {\n\treturn cc.orgs\n}\n\n// ChannelCreationPolicy returns the policy structure used to validate","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/consortium.go#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: swallowing cause\nif err := NewConsortiumsConfig(groups, mspConfigHandler); err != nil {\n    return fmt.Errorf(\"bad consortium\")\n}\n// after: log the wrapped cause\nif err := NewConsortiumsConfig(groups, mspConfigHandler); err != nil {\n    return errors.Wrap(err, \"consortium config rejected\")\n}","handlingStrategy":"validation","validationCode":"for name, v := range consortiumGroup.Values {\n    if v.Value == nil || len(v.Value) == 0 {\n        return fmt.Errorf(\"consortium %q: empty value %q\", consortiumName, name)\n    }\n}\n// optionally pre-decode:\nvar p pb.Consortium\nif err := proto.Unmarshal(consortiumGroup.Values[\"Consortium\"].Value, &p); err != nil {\n    return fmt.Errorf(\"consortium value not decodable: %w\", err)\n}","typeGuard":"func hasDecodableValue(g *cb.ConfigGroup, key string, m proto.Message) bool {\n    cv, ok := g.Values[key]\n    if !ok || cv.Value == nil {\n        return false\n    }\n    return proto.Unmarshal(cv.Value, m) == nil\n}","tryCatchPattern":"cc, err := NewConsortiumConfig(group, mspHandler)\nif err != nil {\n    var cause error\n    errors.As(err, &cause)\n    log.Errorf(\"consortium config rejected: %v (cause: %v)\", err, cause)\n    return err\n}","preventionTips":["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"],"tags":["hyperledger-fabric","channel-config","proto-deserialization","consortium"],"backgroundTag":"proto-deserialization-failed","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}