hyperledger/fabric · error

The required parameter 'version' is empty. Rerun the command

Error message

The required parameter 'version' is empty. Rerun the command with -v flag

What it means

This error is thrown by CommitReadinessCheckInput.Validate() when the chaincode 'version' field is empty. A chaincode definition submitted to a peer must include a version label, so the library rejects the input locally before building the endorsement proposal. The message points to the -v flag of the checkcommitreadiness command.

Source

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

	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",
		Short: "Check whether a chaincode definition is ready to be committed on a channel.",
		Long:  "Check whether a chaincode definition is ready to be committed on a channel.",
		RunE: func(cmd *cobra.Command, args []string) error {
			if c == nil {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Re-run with the -v flag, e.g. 'peer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -v 1.0 --sequence 1'
  2. In Go, set Version on CommitReadinessCheckInput before validation
  3. Fix the script/variable supplying the version so it is non-empty

Example fix

// before
peer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -s 1
// error: required parameter 'version' is empty
// after
peer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -v 1.0 -s 1
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: Calling ReadinessCheck with CommitReadinessCheckInput.Version == "", e.g. running the CLI without the --version/-v flag or binding it from an empty variable.

Common situations: Users omitting -v because package install succeeded without it (packageID path); CI scripts with unset VERSION env var; wrong flag order causing version not to be parsed.

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/856094fd4737c8e4. Report an issue: GitHub.