{"record":{"id":"856094fd4737c8e4","repo":"hyperledger/fabric","slug":"the-required-parameter-version-is-empty-rerun-t-856094","errorCode":null,"errorMessage":"The required parameter 'version' is empty. Rerun the command with -v flag","messagePattern":"The required parameter 'version' is empty\\. Rerun the command with -v flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/checkcommitreadiness.go","lineNumber":74,"sourceCode":"\tInitRequired             bool\n\tPeerAddresses            []string\n\tTxID                     string\n\tOutputFormat             string\n\tInspectionEnabled        bool\n}\n\n// Validate the input for a CheckCommitReadiness proposal\nfunc (c *CommitReadinessCheckInput) Validate() error {\n\tif c.ChannelID == \"\" {\n\t\treturn errors.New(\"The required parameter 'channelID' is empty. Rerun the command with -C flag\")\n\t}\n\n\tif c.Name == \"\" {\n\t\treturn errors.New(\"The required parameter 'name' is empty. Rerun the command with -n flag\")\n\t}\n\n\tif c.Version == \"\" {\n\t\treturn errors.New(\"The required parameter 'version' is empty. Rerun the command with -v flag\")\n\t}\n\n\tif c.Sequence == 0 {\n\t\treturn errors.New(\"The required parameter 'sequence' is empty. Rerun the command with --sequence flag\")\n\t}\n\n\treturn nil\n}\n\n// CheckCommitReadinessCmd returns the cobra command for the\n// CheckCommitReadiness lifecycle operation\nfunc CheckCommitReadinessCmd(c *CommitReadinessChecker, cryptoProvider bccsp.BCCSP) *cobra.Command {\n\tchaincodeCheckCommitReadinessCmd := &cobra.Command{\n\t\tUse:   \"checkcommitreadiness\",\n\t\tShort: \"Check whether a chaincode definition is ready to be committed on a channel.\",\n\t\tLong:  \"Check whether a chaincode definition is ready to be committed on a channel.\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif c == nil {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/checkcommitreadiness.go#L56-L92","documentation":"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.","triggerScenarios":"Calling ReadinessCheck with CommitReadinessCheckInput.Version == \"\", e.g. running the CLI without the --version/-v flag or binding it from an empty variable.","commonSituations":"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.","solutions":["Re-run with the -v flag, e.g. 'peer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -v 1.0 --sequence 1'","In Go, set Version on CommitReadinessCheckInput before validation","Fix the script/variable supplying the version so it is non-empty"],"exampleFix":"// before\npeer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -s 1\n// error: required parameter 'version' is empty\n// after\npeer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -v 1.0 -s 1","handlingStrategy":"validation","validationCode":"func validate(input *CommitReadinessCheckInput) error {\n    if input.Version == \"\" {\n        return fmt.Errorf(\"-v/--version is required: pass the chaincode version\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := input.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"'version' is empty\") {\n        // prompt/fix the version flag and re-run\n    }\n    return err\n}","preventionTips":["Always pass -v <version> matching the version used at approveformyorg","Keep version in a shared variable/manifest used by install, approve, and checkcommitreadiness","Fail fast in scripts if $VERSION is unset (set -u or explicit check)"],"tags":["hyperledger-fabric","chaincode","input-validation","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}