hyperledger/fabric · error

Must supply genesis block path

Error message

Must supply genesis block path

What it means

The join command itself re-validates its inputs and aborts with this message if genesisBlockPath (the -b/--blockpath flag) is unset. It is the command-level guard for the same requirement getJoinCCSpec enforces, raised before any factory or proposal work begins.

Source

Thrown at internal/peer/channel/join.go:119

	proposalResp, err = cf.EndorserClient.ProcessProposal(context.Background(), signedProp)
	if err != nil {
		return ProposalFailedErr(err.Error())
	}

	if proposalResp == nil {
		return ProposalFailedErr("nil proposal response")
	}

	if proposalResp.Response.Status != 0 && proposalResp.Response.Status != http.StatusOK {
		return ProposalFailedErr(fmt.Sprintf("bad proposal response %d: %s", proposalResp.Response.Status, proposalResp.Response.Message))
	}
	logger.Info("Successfully submitted proposal to join channel")
	return nil
}

func join(cmd *cobra.Command, args []string, cf *ChannelCmdFactory) error {
	if genesisBlockPath == common.UndefinedParamValue {
		return errors.New("Must supply genesis block path")
	}
	// Parsing of the command line is done so silence cmd usage
	cmd.SilenceUsage = true

	var err error
	if cf == nil {
		cf, err = InitCmdFactory(EndorserRequired, PeerDeliverNotRequired, OrdererNotRequired)
		if err != nil {
			return err
		}
	}

	spec, err := getJoinCCSpec()
	if err != nil {
		return err
	}

	return executeJoin(cf, spec)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Rerun with the genesis block: `peer channel join -b ./channel-artifacts/mychannel.block`.
  2. Ensure the script exports/sets the block path variable before invoking join.
  3. Verify the genesis block file exists (ls -l) prior to joining.

Example fix

// before
BLOCKFILE=${PWD}/channel-artifacts/${CHANNEL_NAME}.block   # CHANNEL_NAME unset -> empty path
peer channel join -b $BLOCKFILE
// after
: "${CHANNEL_NAME:?must be set}"
peer channel join -b "$BLOCKFILE"
Defensive patterns

Strategy: validation

Validate before calling

// bash
: "${BLOCKFILE:?set -b / BLOCKFILE before running}"
[ -r "$BLOCKFILE" ] || { echo "block file not found: $BLOCKFILE"; exit 1; }
peer channel join -b "$BLOCKFILE"

Prevention

When it happens

Trigger: Running `peer channel join` without the -b flag (or with an empty value), e.g. `peer channel join -b ''` or omitting it entirely.

Common situations: Scripts where the BLOCKFILE variable is empty/unset; documentation examples truncated; calling join from a wrapper that only passes the channel ID.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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