hyperledger/fabric · error

malformed transaction contents: %s

Error message

malformed transaction contents: %s

What it means

Returned by doInspectChannelCreateTx when protolator.DeepMarshalJSON fails to render the unmarshaled envelope as JSON on stdout. The envelope decoded as protobuf, but its nested contents are malformed enough that the deep JSON conversion aborted.

Source

Thrown at cmd/configtxgen/main.go:113

	return nil
}

func doInspectChannelCreateTx(inspectChannelCreateTx string) error {
	logger.Info("Inspecting transaction")
	data, err := os.ReadFile(inspectChannelCreateTx)
	if err != nil {
		return fmt.Errorf("could not read channel create tx: %s", err)
	}

	logger.Info("Parsing transaction")
	env, err := protoutil.UnmarshalEnvelope(data)
	if err != nil {
		return fmt.Errorf("Error unmarshalling envelope: %s", err)
	}

	err = protolator.DeepMarshalJSON(os.Stdout, env)
	if err != nil {
		return fmt.Errorf("malformed transaction contents: %s", err)
	}

	return nil
}

func doPrintOrg(t *genesisconfig.TopLevel, printOrg string) error {
	for _, org := range t.Organizations {
		if org.Name == printOrg {
			if len(org.OrdererEndpoints) > 0 {
				// An Orderer OrgGroup
				channelCapabilities := t.Capabilities["Channel"]
				og, err := encoder.NewOrdererOrgGroup(org, channelCapabilities)
				if err != nil {
					return errors.Wrapf(err, "bad org definition for org %s", org.Name)
				}

				if err := protolator.DeepMarshalJSON(os.Stdout, &ordererext.DynamicOrdererOrgGroup{ConfigGroup: og}); err != nil {
					return errors.Wrapf(err, "malformed org definition for org: %s", org.Name)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Check the wrapped error for the offending protobuf field
  2. Regenerate the channel creation tx from a valid profile
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/configtxgen/main.go:113 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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