{"record":{"id":"460ba5bd6c51f323","repo":"hyperledger/fabric","slug":"the-required-parameter-name-is-empty-rerun-the-460ba5","errorCode":null,"errorMessage":"The required parameter 'name' is empty. Rerun the command with -n flag","messagePattern":"The required parameter 'name' is empty\\. Rerun the command with -n flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/checkcommitreadiness.go","lineNumber":70,"sourceCode":"\tEndorsementPlugin        string\n\tValidationPlugin         string\n\tValidationParameterBytes []byte\n\tCollectionConfigPackage  *pb.CollectionConfigPackage\n\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\",","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/checkcommitreadiness.go#L52-L88","documentation":"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.","triggerScenarios":"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.","commonSituations":"Scripted CI pipelines where the chaincode name variable is unset; copying example commands that omit -n; Go programs constructing CommitReadinessCheckInput{} without setting Name.","solutions":["Re-run the command with the -n flag, e.g. 'peer lifecycle chaincode checkcommitreadiness -C mychannel -n mycc -v 1.0 -s 1'","In Go, set the Name field on CommitReadinessCheckInput before calling Validate/ReadinessCheck","Fix the script/env variable that supplies the chaincode name so it is non-empty"],"exampleFix":"// before\nc := &client.CommitReadinessCheckInput{ChannelID: \"mychannel\"}\nc.Validate() // error: required parameter 'name' is empty\n// after\nc := &client.CommitReadinessCheckInput{ChannelID: \"mychannel\", Name: \"mycc\", Version: \"1.0\", Sequence: 1}\nc.Validate() // nil","handlingStrategy":"validation","validationCode":"func validate(input *CommitReadinessCheckInput) error {\n    if input.Name == \"\" {\n        return fmt.Errorf(\"-n/--name is required: pass the chaincode name\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := input.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"'name' is empty\") {\n        // prompt/fix the name flag and re-run\n    }\n    return err\n}","preventionTips":["Always pass -n <chaincode-name> when running checkcommitreadiness","In Go, construct CommitReadinessCheckInput with all fields set via a constructor/helper that asserts non-empty Name","Validate CLI/env inputs in scripts before invoking the command"],"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"}