hyperledger/fabric · error

failed to deserialize values

Error message

failed to deserialize values

What it means

NewApplicationConfig deserializes each protobuf value in the Application config group via DeserializeProtoValuesFromGroup; any unmarshal failure for the application's embedded protos (policies, capabilities, ACLs, etc.) is wrapped as 'failed to deserialize values'.

Source

Thrown at common/channelconfig/application.go:44

	ACLs         *pb.ACLs
	Capabilities *cb.Capabilities
}

// ApplicationConfig implements the Application interface
type ApplicationConfig struct {
	applicationOrgs map[string]ApplicationOrg
	protos          *ApplicationProtos
}

// NewApplicationConfig creates config from an Application config group
func NewApplicationConfig(appGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ApplicationConfig, error) {
	ac := &ApplicationConfig{
		applicationOrgs: make(map[string]ApplicationOrg),
		protos:          &ApplicationProtos{},
	}

	if err := DeserializeProtoValuesFromGroup(appGroup, ac.protos); err != nil {
		return nil, errors.Wrap(err, "failed to deserialize values")
	}

	if !ac.Capabilities().ACLs() {
		if _, ok := appGroup.Values[ACLsKey]; ok {
			return nil, errors.New("ACLs may not be specified without the required capability")
		}
	}

	var err error
	for orgName, orgGroup := range appGroup.Groups {
		ac.applicationOrgs[orgName], err = NewApplicationOrgConfig(orgName, orgGroup, mspConfig)
		if err != nil {
			return nil, err
		}
	}

	return ac, nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Inspect the wrapped error to find which proto key failed, then regenerate the channel configuration (configtxgen) with matching tooling versions
  2. Ensure all Fabric peers/orderers producing config are on compatible versions
  3. Validate application group values (Capabilities, ACLs, policies) with the same proto definitions before submitting config updates

Example fix

// before
appGroup.Values[ACLsKey] = []byte("acls=read:true") // not a proto message
// after
acls := &pb.ACLs{Resources: map[string]*pb.APIResource{"read": {PolicyRef: "Admins"}}}
appGroup.Values[ACLsKey] = protoutil.MarshalOrPanic(acls)
Defensive patterns

Strategy: validation

Validate before calling

for key, val := range appGroup.Values {
    if len(val.Value) == 0 {
        return fmt.Errorf("application group value %q is empty", key)
    }
    // optionally probe-decode each key with its expected message type before NewChannelConfig
}

Try / catch

ac, err := NewApplicationConfig(appGroup, mspMgr)
if err != nil {
    if strings.Contains(err.Error(), "failed to deserialize values") {
        return fmt.Errorf("corrupt application config group (check Fabric versions / regenerate configtx): %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Building channel configuration through NewChannelConfig (or an anonymous config update handler) where a value under the Application group is corrupt, of the wrong proto type, or was serialized with an incompatible schema.

Common situations: Channel config blocks written by mismatched Fabric versions; manually edited configtx bytes; corrupted orderer-delivered blocks; a value registered under an ApplicationGroup key that does not match the expected message type.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/672e0590b7f3c21e. Report an issue: GitHub.