{"record":{"id":"909de79640b9eff9","repo":"hyperledger/fabric","slug":"must-supply-value-for-s-name-parameter","errorCode":null,"errorMessage":"must supply value for %s name parameter","messagePattern":"must supply value for (.+?) name parameter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/chaincode/common.go","lineNumber":281,"sourceCode":"\t\t\t},\n\t\t}\n\t}\n\n\tif channelConfigPolicy != \"\" {\n\t\tapplicationPolicy = &pb.ApplicationPolicy{\n\t\t\tType: &pb.ApplicationPolicy_ChannelConfigPolicyReference{\n\t\t\t\tChannelConfigPolicyReference: channelConfigPolicy,\n\t\t\t},\n\t\t}\n\t}\n\n\treturn applicationPolicy, nil\n}\n\nfunc checkChaincodeCmdParams(cmd *cobra.Command) error {\n\t// we need chaincode name for everything, including deploy\n\tif chaincodeName == common.UndefinedParamValue {\n\t\treturn errors.Errorf(\"must supply value for %s name parameter\", chainFuncName)\n\t}\n\n\t// Check that non-empty chaincode parameters contain only Args as a key.\n\t// Type checking is done later when the JSON is actually unmarshaled\n\t// into a pb.ChaincodeInput. To better understand what's going\n\t// on here with JSON parsing see http://blog.golang.org/json-and-go -\n\t// Generic JSON with interface{}\n\tif chaincodeCtorJSON != \"{}\" {\n\t\tvar f any\n\t\terr := json.Unmarshal([]byte(chaincodeCtorJSON), &f)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"chaincode argument error\")\n\t\t}\n\t\tm := f.(map[string]any)\n\t\tsm := make(map[string]any)\n\t\tfor k := range m {\n\t\t\tsm[strings.ToLower(k)] = m[k]\n\t\t}","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/chaincode/common.go#L263-L299","documentation":"checkChaincodeCmdParams validates that the chaincode name parameter was supplied via the chainFuncName flag before building the chaincode spec. If the name is still the common.UndefinedParamValue placeholder, the library throws \"must supply value for <chainFuncName> name parameter\" to indicate a required CLI argument is missing.","triggerScenarios":"Running peer chaincode lifecycle commands (install/approve/invoke etc.) without -n/--name, or passing an empty/placeholder value, so chaincodeName remains common.UndefinedParamValue.","commonSituations":"Omitting -n in scripts, using old command templates where the flag was positional, copy-pasting commands with the name left as a literal placeholder like <chaincode-name>.","solutions":["Add the --name (or -n) flag with your chaincode name, e.g. -n mycc","Check the script/CI variable that feeds -n is not empty or unset","Update deprecated command forms to the modern lifecycle syntax which requires -n"],"exampleFix":"// before\npeer chaincode install mycc.tar.gz\n// after\npeer chaincode install mycc.tar.gz --name mycc","handlingStrategy":"validation","validationCode":"if chaincodeName == \"\" {\n\treturn errors.New(\"--name (-n) is required: pass the chaincode name, e.g. -n mycc\")\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.Execute(); err != nil {\n\tif strings.Contains(err.Error(), \"name parameter\") {\n\t\tlog.Fatalf(\"missing -n/--name flag: %v\", err)\n\t}\n\treturn err\n}","preventionTips":["Set the name in one shared variable/script so it cannot be omitted","Use shell parameter expansion to fail early: : \"${CC_NAME:?chaincode name required}\"","Always copy complete command examples including -n"],"tags":["cli","chaincode","missing-parameter","fabric"],"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"}