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

  1. 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).
  2. Run `peer lifecycle chaincode package` first to create the package, then install it.
  3. Review `peer lifecycle chaincode install --help` for the exact flag name in your Fabric version.
  4. 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

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


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/331755dbcfe44996. Report an issue: GitHub.