hyperledger/fabric · error
chaincode install package must be provided
Error message
chaincode install package must be provided
What it means
InstallInput.Validate() requires a chaincode package file path; the --package-type install flow was invoked without one. This is a pure client-side input validation error raised before any network call is made.
Source
Thrown at internal/peer/lifecycle/chaincode/install.go:49
type Installer struct {
Command *cobra.Command
EndorserClient EndorserClient
Input *InstallInput
Reader Reader
Signer Signer
}
// InstallInput holds the input parameters for installing
// a chaincode.
type InstallInput struct {
PackageFile string
}
// Validate checks that the required install parameters
// are provided.
func (i *InstallInput) Validate() error {
if i.PackageFile == "" {
return errors.New("chaincode install package must be provided")
}
return nil
}
// InstallCmd returns the cobra command for chaincode install.
func InstallCmd(i *Installer, cryptoProvider bccsp.BCCSP) *cobra.Command {
chaincodeInstallCmd := &cobra.Command{
Use: "install [packageFile]",
Short: "Install a chaincode.",
Long: "Install a chaincode on a peer.",
ValidArgs: []string{"1"},
RunE: func(cmd *cobra.Command, args []string) error {
if i == nil {
ccInput := &ClientConnectionsInput{
CommandName: cmd.Name(),
EndorserRequired: true,
PeerAddresses: peerAddresses,View on GitHub (pinned to 2736b63f8f)
Solutions
- Pass the package file, e.g. `peer lifecycle chaincode install --path ./archive.tgz` (or the flag your version uses, e.g. a packaged chaincode .tar.gz).
- Run `peer lifecycle chaincode package` first to create the package, then install it.
- Review `peer lifecycle chaincode install --help` for the exact flag name in your Fabric version.
- Fix CI scripts/env files so the package path variable is set.
Example fix
// before peer lifecycle chaincode install // after peer lifecycle chaincode install --path ./mycc.tar.gz
Defensive patterns
Strategy: validation
Validate before calling
if pkgFile == "" {
return errors.New("--package file path is required")
}
if st, err := os.Stat(pkgFile); err != nil || st.IsDir() {
return fmt.Errorf("package file %s not found", pkgFile)
} Try / catch
if err := installCmd.Run(); err != nil {
if strings.Contains(err.Error(), "must be provided") {
// fix script to pass the package path
}
return err
} Prevention
- Always pass the package path flag
- Run `chaincode package` before `install`
- Check --help for your Fabric version's flag name
- Assert required env/args in CI scripts
When it happens
Trigger: Running `peer lifecycle chaincode install` without the --path/-p... more precisely without providing the package file flag (i.PackageFile empty), e.g. missing the path to a packaged chaincode tar.gz produced by `package`.
Common situations: Forgetting the required flag in CI scripts; flag renamed/moved between Fabric versions causing it to be dropped; copy-pasted command missing arguments.
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
- fetch target required, oldest, newest, config, or a number
- Must supply channel ID
- filename cannot be empty
- The required parameter 'package-id' is empty. Rerun the comm
- channel name must be specified
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/331755dbcfe44996.
Report an issue: GitHub.