{"record":{"id":"457ca65d7227b3d0","repo":"hyperledger/fabric","slug":"failed-to-deserialize-values-457ca6","errorCode":null,"errorMessage":"failed to deserialize values","messagePattern":"failed to deserialize values","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/orderer.go","lineNumber":102,"sourceCode":"}\n\n// NewOrdererOrgConfig returns an orderer org config built from the given ConfigGroup.\nfunc NewOrdererOrgConfig(orgName string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*OrdererOrgConfig, error) {\n\tif len(orgGroup.Groups) > 0 {\n\t\treturn nil, fmt.Errorf(\"OrdererOrg config does not allow sub-groups\")\n\t}\n\n\tif !channelCapabilities.OrgSpecificOrdererEndpoints() {\n\t\tif _, ok := orgGroup.Values[EndpointsKey]; ok {\n\t\t\treturn nil, errors.Errorf(\"Orderer Org %s cannot contain endpoints value until V1_4_2+ capabilities have been enabled\", orgName)\n\t\t}\n\t}\n\n\tprotos := &OrdererOrgProtos{}\n\torgProtos := &OrganizationProtos{}\n\n\tif err := DeserializeProtoValuesFromGroup(orgGroup, protos, orgProtos); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to deserialize values\")\n\t}\n\n\tooc := &OrdererOrgConfig{\n\t\tname:   orgName,\n\t\tprotos: protos,\n\t\tOrganizationConfig: &OrganizationConfig{\n\t\t\tname:             orgName,\n\t\t\tprotos:           orgProtos,\n\t\t\tmspConfigHandler: mspConfigHandler,\n\t\t},\n\t}\n\n\tif err := ooc.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ooc, nil\n}","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/orderer.go#L84-L120","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: wrong proto type for Endpoints value\naddrs := &cb.Orderers{Orderers: []string{\"orderer.example.com:7050\"}}\nvalBytes, _ := proto.Marshal(addrs)\ngroup.Values[\"Endpoints\"] = &cb.ConfigValue{Value: valBytes}\n// after: correct proto type\naddrs := &cb.OrdererAddresses{Addresses: []string{\"orderer.example.com:7050\"}}\nvalBytes, _ := proto.Marshal(addrs)\ngroup.Values[\"Endpoints\"] = &cb.ConfigValue{Value: valBytes}","handlingStrategy":"validation","validationCode":"func validateOrdererOrgGroup(orgGroup *cb.ConfigGroup) error {\n\tfor key, val := range orgGroup.Values {\n\t\tswitch key {\n\t\tcase \"Endpoints\":\n\t\t\tvar m cb.OrdererAddresses\n\t\t\tif err := proto.Unmarshal(val.Value, &m); err != nil {\n\t\t\t\treturn fmt.Errorf(\"orderer org value %q is not a valid OrdererAddresses: %w\", key, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":"func isMarshalableValue(msg proto.Message) bool {\n\t_, err := proto.Marshal(msg)\n\treturn err == nil\n}","tryCatchPattern":"ooc, err := channelconfig.NewOrdererOrgConfig(orgName, orgGroup, mspHandler, caps)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to deserialize values\") {\n\t\treturn fmt.Errorf(\"orderer org %q config group contains malformed proto values; re-generate config with configtxgen: %w\", orgName, err)\n\t}\n\treturn err\n}","preventionTips":["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."],"tags":["hyperledger-fabric","protobuf","channel-config","deserialization"],"backgroundTag":"protobuf-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"}