hyperledger/fabric · error

The required parameter 'name' is empty. Rerun the command wi

Error message

The required parameter 'name' is empty. Rerun the command with -n flag

What it means

This error is thrown by CommitReadinessCheckInput.Validate() when the chaincode 'name' field is empty. The checkcommitreadiness command builds a proposal to query a peer for the approval status of a chaincode definition, and 'name' is a mandatory field of that definition. The library fails fast client-side before any network call, telling the user to re-run with the -n flag.

Source

Thrown at internal/peer/lifecycle/chaincode/checkcommitreadiness.go:70

	EndorsementPlugin        string
	ValidationPlugin         string
	ValidationParameterBytes []byte
	CollectionConfigPackage  *pb.CollectionConfigPackage
	InitRequired             bool
	PeerAddresses            []string
	TxID                     string
	OutputFormat             string
	InspectionEnabled        bool
}

// Validate the input for a CheckCommitReadiness proposal
func (c *CommitReadinessCheckInput) Validate() error {
	if c.ChannelID == "" {
		return errors.New("The required parameter 'channelID' is empty. Rerun the command with -C flag")
	}

	if c.Name == "" {
		return errors.New("The required parameter 'name' is empty. Rerun the command with -n flag")
	}

	if c.Version == "" {
		return errors.New("The required parameter 'version' is empty. Rerun the command with -v flag")
	}

	if c.Sequence == 0 {
		return errors.New("The required parameter 'sequence' is empty. Rerun the command with --sequence flag")
	}

	return nil
}

// CheckCommitReadinessCmd returns the cobra command for the
// CheckCommitReadiness lifecycle operation
func CheckCommitReadinessCmd(c *CommitReadinessChecker, cryptoProvider bccsp.BCCSP) *cobra.Command {
	chaincodeCheckCommitReadinessCmd := &cobra.Command{
		Use:   "checkcommitreadiness",

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Re-run the command with the -n flag, e.g. 'peer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -v 1.0 -s 1'
  2. In Go, set the Name field on CommitReadinessCheckInput before calling Validate/ReadinessCheck
  3. Fix the script/env variable that supplies the chaincode name so it is non-empty

Example fix

// before
c := &client.CommitReadinessCheckInput{ChannelID: "mychannel"}
c.Validate() // error: required parameter 'name' is empty
// after
c := &client.CommitReadinessCheckInput{ChannelID: "mychannel", Name: "mycc", Version: "1.0", Sequence: 1}
c.Validate() // nil
Defensive patterns

Strategy: validation

Validate before calling

func validate(input *CommitReadinessCheckInput) error {
    if input.Name == "" {
        return fmt.Errorf("-n/--name is required: pass the chaincode name")
    }
    return nil
}

Try / catch

if err := input.Validate(); err != nil {
    if strings.Contains(err.Error(), "'name' is empty") {
        // prompt/fix the name flag and re-run
    }
    return err
}

Prevention

When it happens

Trigger: Calling ReadinessCheck (or running 'peer lifecycle chaincode checkcommitreadiness') with a CommitReadinessCheckInput whose Name field is the empty string, e.g. because the --name/-n flag was omitted or bound from an empty variable.

Common situations: Scripted CI pipelines where the chaincode name variable is unset; copying example commands that omit -n; Go programs constructing CommitReadinessCheckInput{} without setting Name.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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