{"record":{"id":"100316413e894679","repo":"hyperledger/fabric","slug":"failed-to-deserialize-values-100316","errorCode":null,"errorMessage":"failed to deserialize values","messagePattern":"failed to deserialize values","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/channelconfig/organization.go","lineNumber":51,"sourceCode":"\tmsp              msp.MSP\n\tmspID            string\n\tname             string\n}\n\n// NewOrganizationConfig creates a new config for an organization\nfunc NewOrganizationConfig(name string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler) (*OrganizationConfig, error) {\n\tif len(orgGroup.Groups) > 0 {\n\t\treturn nil, fmt.Errorf(\"organizations do not support sub-groups\")\n\t}\n\n\toc := &OrganizationConfig{\n\t\tprotos:           &OrganizationProtos{},\n\t\tname:             name,\n\t\tmspConfigHandler: mspConfigHandler,\n\t}\n\n\tif err := DeserializeProtoValuesFromGroup(orgGroup, oc.protos); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to deserialize values\")\n\t}\n\n\tif err := oc.Validate(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn oc, nil\n}\n\n// Name returns the name this org is referred to in config\nfunc (oc *OrganizationConfig) Name() string {\n\treturn oc.name\n}\n\n// MSPID returns the MSP ID associated with this org\nfunc (oc *OrganizationConfig) MSPID() string {\n\treturn oc.mspID\n}","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/channelconfig/organization.go#L33-L69","documentation":"NewOrganizationConfig calls DeserializeProtoValuesFromGroup to unmarshal each org config Value into its expected proto (e.g. MSPConfig). If a value is missing, unexpected, or fails proto unmarshalling, the error is wrapped as \"failed to deserialize values\". The root cause is malformed or mismatched config values in the org group.","triggerScenarios":"An org ConfigGroup whose Values don't match the expected proto schema — e.g. the MSP value bytes are not a valid serialized FabricMSPConfig, a required value key (like MSP) is missing from the lookup, or bytes were double-encoded (base64 string instead of raw bytes).","commonSituations":"Manually assembling config updates with hand-marshaled protos; converting configs between formats (JSON/YAML) and base64-encoding bytes that should stay raw; version mismatches where a newer Fabric writes values an older parser can't unmarshal.","solutions":["Ensure the org group contains a valid MSP value with correctly serialized FabricMSPConfig bytes","Inspect the wrapped underlying error (errors.Wrap) for the exact value key that failed","Regenerate the org config with configtxgen rather than hand-crafting proto bytes"],"exampleFix":"// before: double-encoded value\nvalue := []byte(base64.StdEncoding.EncodeToString(mspConfigBytes))\n// after: raw proto bytes\nvalue := mspConfigBytes","handlingStrategy":"validation","validationCode":"// ensure the org group has a parseable MSP value before calling NewOrganizationConfig\nvar mspValue *mb.MSPConfig\nif v, ok := orgGroup.Values[\"MSP\"]; !ok {\n\treturn fmt.Errorf(\"org group missing MSP value\")\n} else if err := proto.Unmarshal(v.Value, mspValue); err != nil {\n\treturn fmt.Errorf(\"org MSP value is not valid proto bytes: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"oc, err := channelconfig.NewOrganizationConfig(name, orgGroup, mspHandler)\nif err != nil && strings.Contains(err.Error(), \"failed to deserialize values\") {\n\treturn fmt.Errorf(\"check org config value bytes (no base64 double-encoding, valid protos): %w\", err)\n}","preventionTips":["Always pass raw proto bytes, never base64-encoded strings, into ConfigValue.Value","Generate org configs with configtxgen instead of hand-marshaling protos","Log errors.Unwrap(err) to identify which value key failed to unmarshal"],"tags":["hyperledger-fabric","channelconfig","proto","deserialization"],"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"}