hyperledger/fabric · warning

Message was empty

Error message

Message was empty

What it means

ErrEmptyMessage is the sentinel returned by the emptyRejectRule, the first rule in the broadcast filter chain. Any Envelope whose Payload field is nil is rejected immediately with this error since there is nothing to process. It is the standard way the orderer signals an empty broadcast message.

Source

Thrown at orderer/common/msgprocessor/filter.go:16

/*
Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package msgprocessor

import (
	"errors"

	ab "github.com/hyperledger/fabric-protos-go-apiv2/common"
)

// ErrEmptyMessage is returned by the empty message filter on rejection.
var ErrEmptyMessage = errors.New("Message was empty")

// Rule defines a filter function which accepts, rejects, or forwards (to the next rule) an Envelope
type Rule interface {
	// Apply applies the rule to the given Envelope, either successfully or returns error
	Apply(message *ab.Envelope) error
}

// EmptyRejectRule rejects empty messages
var EmptyRejectRule = Rule(emptyRejectRule{})

type emptyRejectRule struct{}

func (a emptyRejectRule) Apply(message *ab.Envelope) error {
	if message.Payload == nil {
		return ErrEmptyMessage
	}
	return nil
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Set the Payload on the Envelope before sending: marshal a common.Payload (header + data) and assign its bytes to envelope.Payload.
  2. Sign the fully populated envelope client-side and verify the SDK version matches the orderer's protobuf expectations.
  3. Add client-side validation to reject nil payloads before invoking broadcast.
  4. If envelopes are produced by another service, log/inspect the outgoing bytes to find where the payload is dropped.

Example fix

// before
env := &common.Envelope{Signature: sig}        // Payload never set
// after
payloadBytes, _ := proto.Marshal(payload)
env := &common.Envelope{Payload: payloadBytes, Signature: sig}
Defensive patterns

Strategy: validation

Validate before calling

if env.Payload == nil || len(env.Payload) == 0 { return errors.New("cannot broadcast: envelope payload is empty") }

Try / catch

if err := broadcast.Send(env); err != nil && errors.Is(err, msgprocessor.ErrEmptyMessage) { construct and attach a valid Payload before retrying }

Prevention

When it happens

Trigger: A client calls the broadcast service with an Envelope that has Payload == nil; emptyRejectRule.Apply returns ErrEmptyMessage and the transaction is rejected before any signature or ACL checks.

Common situations: Buggy client SDK constructing Envelope{} without setting Payload; code paths that clear the payload after signing; tests/tools submitting placeholder envelopes; network proxies stripping or failing to forward the payload bytes.

Related errors


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