hyperledger/fabric · error

chaincode address not provided

Error message

chaincode address not provided

What it means

ChaincodeServerUserData.ChaincodeServerInfo builds the ChaincodeServerInfo used by the peer to connect to a chaincode server; it requires the chaincode to publish the address it listens on. An empty address makes the connection info unusable, so Fabric errors.

Source

Thrown at core/container/externalbuilder/instance.go:79

	return nil
}

// ChaincodeServerUserData holds "connection.json" information
type ChaincodeServerUserData struct {
	Address            string   `json:"address"`
	Domain             string   `json:"domain"`
	DialTimeout        Duration `json:"dial_timeout"`
	TLSRequired        bool     `json:"tls_required"`
	ClientAuthRequired bool     `json:"client_auth_required"`
	ClientKey          string   `json:"client_key"`  // PEM encoded client key
	ClientCert         string   `json:"client_cert"` // PEM encoded client certificate
	RootCert           string   `json:"root_cert"`   // PEM encoded peer chaincode certificate
}

func (c *ChaincodeServerUserData) ChaincodeServerInfo(cryptoDir string) (*ccintf.ChaincodeServerInfo, error) {
	if c.Address == "" {
		return nil, errors.New("chaincode address not provided")
	}
	connInfo := &ccintf.ChaincodeServerInfo{Address: c.Address}

	connInfo.ClientConfig.DialTimeout = time.Duration(c.DialTimeout)
	if connInfo.ClientConfig.DialTimeout == 0 {
		connInfo.ClientConfig.DialTimeout = DialTimeout
	}

	// we can expose this if necessary
	connInfo.ClientConfig.KaOpts = comm.DefaultKeepaliveOptions

	if !c.TLSRequired {
		return connInfo, nil
	}
	if c.ClientAuthRequired && c.ClientKey == "" {
		return nil, errors.New("chaincode tls key not provided")
	}
	if c.ClientAuthRequired && c.ClientCert == "" {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Ensure the chaincode writes connection.json including a non-empty `address` (host:port) in the release directory
  2. Fix the release script so it copies the complete connection.json into the release dir
  3. Verify the chaincode's CaaS config (CORE_CHAINCODE_ID, TLS settings) causes it to publish its address

Example fix

// before (connection.json)
{"client_cert":"..."}
// after
{"address":"chaincode:7052","client_cert":"...","root_cert":"..."}
Defensive patterns

Strategy: validation

Validate before calling

var ud ChaincodeServerUserData
json.Unmarshal(connJSON, &ud)
if ud.Address == "" {
    return errors.New("connection.json must include a non-empty address")
}

Try / catch

info, err := ud.ChaincodeServerInfo(cryptoDir)
if err != nil && strings.Contains(err.Error(), "address not provided") {
    return fmt.Errorf("chaincode did not publish its endpoint; check release step emitted connection.json: %w", err)
}

Prevention

When it happens

Trigger: connection.json written by the builder's release step lacks the `address` field or it is empty, and TLS/launch processing calls ChaincodeServerInfo.

Common situations: Chaincode-as-a-service container didn't emit connection.json; template omitted address; chaincode listens but never reports its endpoint; release script copies a partial connection.json.

Related errors


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