hyperledger/fabric · error

external builder at path %s has no name attribute

Error message

external builder at path %s has no name attribute

What it means

Peer config load requires each externalBuilders entry to have a non-empty name; when a builder has a valid path but no name attribute, load() fails with this message that includes the offending path. The name is the builder identifier recorded in the chaincode package, so it cannot be blank. This is a startup-time YAML validation error.

Source

Thrown at core/peer/config.go:307

	if c.VMNetworkMode == "" {
		c.VMNetworkMode = "host"
	}

	c.ChaincodePull = viper.GetBool("chaincode.pull")
	var externalBuilders []ExternalBuilder

	err = viper.UnmarshalKey("chaincode.externalBuilders", &externalBuilders, viper.DecodeHook(viperutil.YamlStringToStructHook(externalBuilders)))
	if err != nil {
		return err
	}

	c.ExternalBuilders = externalBuilders
	for builderIndex, builder := range c.ExternalBuilders {
		if builder.Path == "" {
			return errors.New("invalid external builder configuration, path attribute missing in one or more builders")
		}
		if builder.Name == "" {
			return fmt.Errorf("external builder at path %s has no name attribute", builder.Path)
		}
		if builder.Environment != nil && len(builder.PropagateEnvironment) == 0 {
			c.ExternalBuilders[builderIndex].PropagateEnvironment = builder.Environment
		}
	}

	c.OperationsListenAddress = viper.GetString("operations.listenAddress")
	c.OperationsTLSEnabled = viper.GetBool("operations.tls.enabled")
	c.OperationsTLSCertFile = config.GetPath("operations.tls.cert.file")
	c.OperationsTLSKeyFile = config.GetPath("operations.tls.key.file")
	c.OperationsTLSClientAuthRequired = viper.GetBool("operations.tls.clientAuthRequired")

	for _, rca := range viper.GetStringSlice("operations.tls.clientRootCAs.files") {
		c.OperationsTLSClientRootCAs = append(c.OperationsTLSClientRootCAs, config.TranslatePath(configDir, rca))
	}

	c.MetricsProvider = viper.GetString("metrics.provider")
	c.StatsdNetwork = viper.GetString("metrics.statsd.network")

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Add the name attribute to the builder entry whose path is named in the error, e.g. name: ccaas-builder, and restart the peer.
  2. Check YAML indentation so name sits in the same list item mapping as path.
  3. If name comes from a template value, fix the variable so it resolves to a non-empty identifier.
  4. Remove the broken builder entry if the builder is not used.

Example fix

# before
externalBuilders:
  - path: /builders/ccaas_builder
# after
externalBuilders:
  - name: ccaas-builder
    path: /builders/ccaas_builder
Defensive patterns

Strategy: validation

Validate before calling

var cfg struct {
    ExternalBuilders []struct {
        Name string `yaml:"name"`
        Path string `yaml:"path"`
    } `yaml:"externalBuilders"`
}
if err := yaml.Unmarshal(coreYAML, &cfg); err != nil { return err }
for i, b := range cfg.ExternalBuilders {
    if b.Name == "" {
        return fmt.Errorf("externalBuilders[%d] at %s missing name", i, b.Path)
    }
}

Try / catch

if err := peer.Config(); err != nil {
    if strings.Contains(err.Error(), "has no name attribute") {
        return fmt.Errorf("add name to the builder at the reported path: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: A core.yaml externalBuilders entry with path set but the name key missing or empty; a builder stanza whose name is provided only via an env-expanded variable that resolves to empty.

Common situations: Writing a builder entry by hand and omitting the name line; template rendering producing an empty name; copy/paste errors where the name was accidentally deleted; YAML indentation mistakes that push the name key into the wrong mapping.

Related errors


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