hyperledger/fabric · error
must supply value for %s name parameter
Error message
must supply value for %s name parameter
What it means
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.
Source
Thrown at internal/peer/chaincode/common.go:281
},
}
}
if channelConfigPolicy != "" {
applicationPolicy = &pb.ApplicationPolicy{
Type: &pb.ApplicationPolicy_ChannelConfigPolicyReference{
ChannelConfigPolicyReference: channelConfigPolicy,
},
}
}
return applicationPolicy, nil
}
func checkChaincodeCmdParams(cmd *cobra.Command) error {
// we need chaincode name for everything, including deploy
if chaincodeName == common.UndefinedParamValue {
return errors.Errorf("must supply value for %s name parameter", chainFuncName)
}
// Check that non-empty chaincode parameters contain only Args as a key.
// Type checking is done later when the JSON is actually unmarshaled
// into a pb.ChaincodeInput. To better understand what's going
// on here with JSON parsing see http://blog.golang.org/json-and-go -
// Generic JSON with interface{}
if chaincodeCtorJSON != "{}" {
var f any
err := json.Unmarshal([]byte(chaincodeCtorJSON), &f)
if err != nil {
return errors.Wrap(err, "chaincode argument error")
}
m := f.(map[string]any)
sm := make(map[string]any)
for k := range m {
sm[strings.ToLower(k)] = m[k]
}View on GitHub (pinned to 2736b63f8f)
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
Example fix
// before peer chaincode install mycc.tar.gz // after peer chaincode install mycc.tar.gz --name mycc
Defensive patterns
Strategy: validation
Validate before calling
if chaincodeName == "" {
return errors.New("--name (-n) is required: pass the chaincode name, e.g. -n mycc")
} Try / catch
if err := cmd.Execute(); err != nil {
if strings.Contains(err.Error(), "name parameter") {
log.Fatalf("missing -n/--name flag: %v", err)
}
return err
} Prevention
- 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
When it happens
Trigger: Running peer chaincode lifecycle commands (install/approve/invoke etc.) without -n/--name, or passing an empty/placeholder value, so chaincodeName remains common.UndefinedParamValue.
Common situations: 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>.
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
- cannot specify both "--signature-policy" and "--channel-conf
- The required parameter 'channelID' is empty. Rerun the comma
- The required parameter 'channelID' is empty. Rerun the comma
- only applicable for private data
- unknown operation type
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/909de79640b9eff9.
Report an issue: GitHub.