hyperledger/fabric · error

not a config block

Error message

not a config block

What it means

Sentinel ErrNotAConfig returned by ConfigFromBlock when the block's first transaction is not a CONFIG-type transaction — callers compare against this exact error to distinguish 'wrong kind of block' from real parse failures.

Source

Thrown at common/deliverclient/util.go:16

/*
Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package deliverclient

import (
	"github.com/hyperledger/fabric-protos-go-apiv2/common"
	"github.com/hyperledger/fabric/common/configtx"
	"github.com/hyperledger/fabric/protoutil"
	"github.com/pkg/errors"
)

var ErrNotAConfig = errors.New("not a config block")

// ConfigFromBlock returns a ConfigEnvelope if exists, or a *ErrNotAConfig error.
// It may also return some other error in case parsing failed.
func ConfigFromBlock(block *common.Block) (*common.ConfigEnvelope, error) {
	if block == nil || block.Data == nil || len(block.Data.Data) == 0 {
		return nil, errors.New("empty block")
	}
	txn := block.Data.Data[0]
	env, err := protoutil.GetEnvelopeFromBlock(txn)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	payload, err := protoutil.UnmarshalPayload(env.Payload)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	if block.Header.Number == 0 {
		configEnvelope, err := configtx.UnmarshalConfigEnvelope(payload.Data)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Pass a config block (genesis or a config-update block) instead of a data block
  2. Skip the block when ErrNotAConfig is returned, as cluster/util.go does
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at common/deliverclient/util.go:16 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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