{"record":{"id":"fc0267e88bab3c5d","repo":"hyperledger/fabric","slug":"the-required-parameter-name-is-empty-rerun-the-fc0267","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/commit.go","lineNumber":67,"sourceCode":"\tEndorsementPlugin        string\n\tValidationPlugin         string\n\tValidationParameterBytes []byte\n\tCollectionConfigPackage  *pb.CollectionConfigPackage\n\tInitRequired             bool\n\tPeerAddresses            []string\n\tWaitForEvent             bool\n\tWaitForEventTimeout      time.Duration\n\tTxID                     string\n}\n\n// Validate the input for a CommitChaincodeDefinition proposal\nfunc (c *CommitInput) 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// CommitCmd returns the cobra command for chaincode Commit\nfunc CommitCmd(c *Committer, cryptoProvider bccsp.BCCSP) *cobra.Command {\n\tchaincodeCommitCmd := &cobra.Command{\n\t\tUse:   \"commit\",\n\t\tShort: \"Commit the chaincode definition on the channel.\",","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/commit.go#L49-L85","documentation":"Returned by CommitInput.Validate when the chaincode name is empty in a 'peer lifecycle chaincode commit' invocation. The user omitted the mandatory -n flag; validation runs before any proposal is built.","triggerScenarios":"Constructing CommitInput with Name == \"\" and calling Validate, e.g. running `peer lifecycle chaincode commit` without -n.","commonSituations":"Forgotten -n flag; script variable for the chaincode name unset/empty due to shell quoting or a failed substitution; programmatic use where the name field of the definition was not copied from the approve step.","solutions":["Rerun with -n <chaincode-name>, e.g. -n mycc.","Verify the name exactly matches the name used in approveformyorg.","Check wrapper scripts for empty shell variables feeding -n.","In code, set CommitInput.Name before calling Commit."],"exampleFix":"// before\npeer lifecycle chaincode commit -C mychannel -v 1.0 --sequence 1\n// after\npeer lifecycle chaincode commit -C mychannel -n mycc -v 1.0 --sequence 1","handlingStrategy":"validation","validationCode":"if name == \"\" {\n    return errors.New(\"chaincode name required: use -n flag\")\n}","typeGuard":"func hasName(c *CommitInput) bool { return c != nil && c.Name != \"\" }","tryCatchPattern":"if err := run(); err != nil {\n    if strings.Contains(err.Error(), \"parameter 'name' is empty\") {\n        // prompt for chaincode name or print usage\n    }\n}","preventionTips":["Always pass -n with the exact chaincode name used in approveformyorg.","Quote shell variables to avoid empty substitutions.","Keep name/version/sequence together in one config source."],"tags":["hyperledger-fabric","input-validation","cli-flags"],"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"}