hyperledger/fabric · error

no DockerBuilder, cannot build

Error message

no DockerBuilder, cannot build

What it means

The BuildRegistry Build method reached the end of its external-builder loop without producing an instance, so it falls back to the legacy Docker build path. If no DockerBuilder is configured on the registry, there is no way to build the chaincode, and this error is thrown.

Source

Thrown at core/container/container.go:117

	if r.ExternalBuilder != nil {
		// for now, the package ID we retrieve from the FS is always the ccid
		// the chaincode uses for registration
		_, mdBytes, codeStream, err := r.PackageProvider.GetChaincodePackage(ccid)
		if err != nil {
			return errors.WithMessage(err, "failed to get chaincode package for external build")
		}
		defer codeStream.Close()

		instance, err = r.ExternalBuilder.Build(ccid, mdBytes, codeStream)
		if err != nil {
			return errors.WithMessage(err, "external builder failed")
		}
	}

	if instance == nil {
		if r.DockerBuilder == nil {
			return errors.New("no DockerBuilder, cannot build")
		}
		metadata, _, codeStream, err := r.PackageProvider.GetChaincodePackage(ccid)
		if err != nil {
			return errors.WithMessage(err, "failed to get chaincode package for docker build")
		}
		defer codeStream.Close()

		instance, err = r.DockerBuilder.Build(ccid, metadata, codeStream)
		if err != nil {
			return errors.WithMessage(err, "docker build failed")
		}
	}

	r.mutex.Lock()
	defer r.mutex.Unlock()
	if r.containers == nil {
		r.containers = map[string]Instance{}
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Configure/install an external builder whose package type matches the installed chaincode package.
  2. Provide a DockerBuilder to the BuildRegistry (wire it in peer construction) if you rely on legacy docker chaincode builds.
  3. Repackage the chaincode using a type supported by your configured external builders (e.g. ccenv-based or CAAS type).
  4. Check peer log lines above the error for 'external builder failed' to see why the builder did not produce an instance, and fix that builder.

Example fix

// before: registry without docker support building a legacy package
registry := container.NewBuildRegistry(pkgProvider, nil, builders...)

// after: wire a DockerBuilder as fallback
registry := container.NewBuildRegistry(pkgProvider, dockerProvider, builders...)
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: confirm some builder can handle this package type
pkgType := getPackageType(ccid)
matched := false
for _, b := range externalBuilders {
	if b.Matches(pkgType) { matched = true; break }
}
if !matched && dockerBuilder == nil {
	return errors.Errorf("package type %s has no builder configured", pkgType)
}

Type guard

func canBuild(r *BuildRegistry, ccid string) bool {
	return r.DockerBuilder != nil || r.externalBuilderMatches(ccid)
}

Try / catch

instance, err := registry.Build(ccid)
if err != nil {
	if strings.Contains(err.Error(), "no DockerBuilder") {
		return errors.WithMessage(err,
			"install an external builder for this package type or enable docker builds")
	}
	return err
}

Prevention

When it happens

Trigger: Calling Build(ccid) for a package whose chaincode type matches no configured external builder (or all external builders failed/did not emit a connection.json), while r.DockerBuilder == nil — e.g. Docker build support not wired into the registry (docker build disabled in configuration).

Common situations: Using external builders only (no Docker) but installing a package type (e.g. golang/node/java legacy type) with no matching external builder; external builder 'name' mismatch with the package type; DockerBuilder omitted when constructing the BuildRegistry; fabric release where docker chaincode build was removed/disabled.

Related errors


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