hyperledger/fabric · error

Unknown message type: %v

Error message

Unknown message type: %v

What it means

Fallback error of IsTagLegal: the message matches none of the known content categories (data, pull, state transfer, leadership), so its tag cannot be validated and the whole message is reported as unknown.

Source

Thrown at gossip/protoext/message.go:185

			return fmt.Errorf("Invalid PullMsgType: %s", gossip.PullMsgType_name[int32(GetPullMsgType(m))])
		}
	}

	if IsStateInfoMsg(m) || IsStateInfoPullRequestMsg(m) || IsStateInfoSnapshot(m) || IsRemoteStateMessage(m) {
		if m.Tag != gossip.GossipMessage_CHAN_OR_ORG {
			return fmt.Errorf("Tag should be %s", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_CHAN_OR_ORG)])
		}
		return nil
	}

	if IsLeadershipMsg(m) {
		if m.Tag != gossip.GossipMessage_CHAN_AND_ORG {
			return fmt.Errorf("Tag should be %s", gossip.GossipMessage_Tag_name[int32(gossip.GossipMessage_CHAN_AND_ORG)])
		}
		return nil
	}

	return fmt.Errorf("Unknown message type: %v", m)
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Populate the GossipMessage Content with a supported type before validating
  2. Drop or ignore empty/unknown gossip messages instead of forwarding them
  3. Align fabric versions across peers so all message types are recognized

Example fix

// before
msg := proto.ZeroGossipMessage
err := protoext.IsTagLegal(signedMsg) // unknown type
// after
msg.Content = &gossip.GossipMessage_DataMsg{Data: ...}
err := protoext.IsTagLegal(signedMsg)
Defensive patterns

Strategy: validation

Validate before calling

if msg == nil || msg.Content == nil {
    return errors.New("gossip message has no content; cannot validate tag")
}

Type guard

func hasKnownContent(m *gossip.GossipMessage) bool {
    return m != nil && m.Content != nil && (protoext.IsDataMsg(m) || protoext.IsPullMsg(m) ||
        protoext.IsStateInfoMsg(m) || protoext.IsStateInfoPullRequestMsg(m) ||
        protoext.IsStateInfoSnapshot(m) || protoext.IsRemoteStateMessage(m) || protoext.IsLeadershipMsg(m))
}

Prevention

When it happens

Trigger: Calling IsTagLegal on a GossipMessage whose Content field is nil, empty, or a content type not covered by the IsXxxMsg predicates (e.g. an empty message, membership-less envelopes, or future/unrecognized content types).

Common situations: Messages created with proto.ZeroGossipMessage but never populated; payloads decoded from an incompatible fabric version introducing new message types; test scaffolding sending placeholder messages.

Related errors


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