hyperledger/fabric · error

No signatures for nil Envelope

Error message

No signatures for nil Envelope

What it means

EnvelopeAsSignedData extracts the signature data from a common.Envelope: it unmarshals the payload and pairs env.Payload with env.Signature and the creator from the SignatureHeader. A nil Envelope has no signature to extract, so this error is returned immediately.

Source

Thrown at protoutil/signeddata.go:63

			return nil, err
		}

		result[i] = &SignedData{
			Data:      bytes.Join([][]byte{configSig.SignatureHeader, ce.ConfigUpdate}, nil),
			Identity:  sigHeader.Creator,
			Signature: configSig.Signature,
		}

	}

	return result, nil
}

// EnvelopeAsSignedData returns the signatures for the Envelope as SignedData
// slice of length 1 or an error indicating why this was not possible.
func EnvelopeAsSignedData(env *common.Envelope) ([]*SignedData, error) {
	if env == nil {
		return nil, errors.New("No signatures for nil Envelope")
	}

	payload := &common.Payload{}
	err := proto.Unmarshal(env.Payload, payload)
	if err != nil {
		return nil, err
	}

	if payload.Header == nil /* || payload.Header.SignatureHeader == nil */ {
		return nil, errors.New("Missing Header")
	}

	shdr := &common.SignatureHeader{}
	err = proto.Unmarshal(payload.Header.SignatureHeader, shdr)
	if err != nil {
		return nil, fmt.Errorf("GetSignatureHeaderFromBytes failed, err %s", err)
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Guard with a nil check on the envelope before calling EnvelopeAsSignedData and reject the request early.
  2. Ensure GetEnvelopeFromBlock / proto unmarshaling errors are handled so nil envelopes never reach ACL checks.
  3. When building envelopes programmatically, marshal a valid Payload into env.Payload before submission.
  4. In tests, use a minimal valid envelope rather than nil to exercise the intended path.

Example fix

// before
sd, err := protoutil.EnvelopeAsSignedData(env)

// after
if env == nil {
    return status.Error(codes.InvalidArgument, "envelope is nil")
}
sd, err := protoutil.EnvelopeAsSignedData(env)
Defensive patterns

Strategy: type-guard

Validate before calling

if env == nil || len(env.Payload) == 0 {
    return errors.New("envelope with payload required")
}

Type guard

func validEnvelope(env *common.Envelope) bool {
    return env != nil && len(env.Payload) > 0
}

Try / catch

sd, err := protoutil.EnvelopeAsSignedData(env)
if err != nil {
    return fmt.Errorf("cannot check ACL: %w", err)
}

Prevention

When it happens

Trigger: Calling EnvelopeAsSignedData(nil) — e.g. CheckACL / CheckACLNoChannel or NewSessionAC receiving a nil envelope because a prior GetEnvelopeFromBlock / Unmarshal step failed or returned nil without propagating an error.

Common situations: ACL resource provider invoked with an envelope extracted from a malformed block; deliver sessions created with a nil envelope; tests exercising the nil case; transaction filters dropping payloads upstream leaving nil envelopes.

Related errors


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