hyperledger/fabric · error

could not get connection info

Error message

could not get connection info

What it means

The launcher could not build ChaincodeClientInfo (connection details such as package ID, address, TLS root certs) for the chaincode. In the peer-as-server default model this info is required to start the container, so launch aborts immediately.

Source

Thrown at core/chaincode/runtime_launcher.go:107

			if ccservinfo != nil {
				if err = r.ConnectionHandler.Stream(ccid, ccservinfo, streamHandler); err != nil {
					startFailCh <- errors.WithMessagef(err, "connection to %s failed", ccid)
					return
				}

				launchState.Notify(errors.Errorf("connection to %s terminated", ccid))
				return
			}

			// default peer-as-server model... compute connection information for CC callback
			// and proceed to launch chaincode
			ccinfo, err := r.ChaincodeClientInfo(ccid)
			if err != nil {
				startFailCh <- errors.WithMessage(err, "could not get connection info")
				return
			}
			if ccinfo == nil {
				startFailCh <- errors.New("could not get connection info")
				return
			}
			if err = r.Runtime.Start(ccid, ccinfo); err != nil {
				startFailCh <- errors.WithMessage(err, "error starting container")
				return
			}
			exitCode, err := r.Runtime.Wait(ccid)
			if err != nil {
				launchState.Notify(errors.Wrap(err, "failed to wait on container exit"))
			}
			launchState.Notify(errors.Errorf("container exited with %d", exitCode))
		}()
	}

	var err error
	select {
	case <-launchState.Done():
		err = errors.WithMessage(launchState.Err(), "chaincode registration failed")

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Check that the chaincode package is installed: peer lifecycle chaincode queryinstalled
  2. Re-install/re-commit the chaincode package if missing or corrupted
  3. Inspect the peer's chaincode package store on disk and peer logs for the underlying error
  4. Restart the peer to reload chaincode package metadata

Example fix

// before: launching uninstalled package
peer chaincode invoke -C mychannel -n mycc ...  // -> could not get connection info
// after
peer lifecycle chaincode install mycc.tar.gz
peer lifecycle chaincode approveformyorg ...
peer chaincode invoke -C mychannel -n mycc ...
Defensive patterns

Strategy: validation

Validate before calling

pkgs, _ := Stub{}.QueryInstalled() // client-side equivalent:
// run: peer lifecycle chaincode queryinstalled | grep <packageID>
// only invoke after the package is installed and committed on the channel

Type guard

func hasConnectionInfo(info *ChaincodeClientInfo) bool { return info != nil && info.PackageID != "" }

Try / catch

if err := launcher.Launch(ccid); err != nil && strings.Contains(err.Error(), "could not get connection info") {
    // re-run: peer lifecycle chaincode install ...
}

Prevention

When it happens

Trigger: r.ChaincodeClientInfo(ccid) returns an error, or returns nil info, during Launch() of a chaincode under the default peer-as-server model.

Common situations: Chaincode package not installed/committed so the peer has no package metadata for the package ID; corrupted installed chaincode package store; lifecycle (LSCC/_lifecycle) metadata missing or mismatched after upgrade.

Related errors


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