hyperledger/fabric · error

No image provided and "chaincode.builder" default does not e

Error message

No image provided and "chaincode.builder" default does not exist

What it means

util.DockerBuild requires a builder image: either opts.Image or the 'chaincode.builder' core.yaml config key must name a docker image. If both are empty, the function cannot create the ephemeral build container and returns this error immediately.

Source

Thrown at core/chaincode/platforms/util/utils.go:66

// Therefore, this mechanism creates a pipeline consisting of an ephemeral docker
// container that accepts source code as input, runs some function (e.g. "go build"), and
// outputs the result.  The intention is that this output will be consumed as the basis of
// a streamlined container by installing the output into a downstream docker-build based on
// an appropriate minimal image.
//
// The input parameters are fairly simple:
//   - Image:        (optional) The builder image to use or "chaincode.builder"
//   - Cmd:          The command to execute inside the container.
//   - InputStream:  A tarball of files that will be expanded into /chaincode/input.
//   - OutputStream: A tarball of files that will be gathered from /chaincode/output
//     after successful execution of Cmd.
//
// -------------------------------------------------------------------------------------------
func DockerBuild(opts DockerBuildOptions, client dcli.APIClient) error {
	if opts.Image == "" {
		opts.Image = GetDockerImageFromConfig("chaincode.builder")
		if opts.Image == "" {
			return fmt.Errorf("No image provided and \"chaincode.builder\" default does not exist")
		}
	}

	logger.Debugf("Attempting build with options: %s", opts)

	// -----------------------------------------------------------------------------------
	// Ensure the image exists locally, or pull it from a registry if it doesn't
	// -----------------------------------------------------------------------------------
	_, err := client.ImageInspect(context.Background(), opts.Image)
	if err != nil {
		logger.Debugf("Image %s does not exist locally, attempt pull", opts.Image)

		ipResp, err := client.ImagePull(context.Background(), opts.Image, dcli.ImagePullOptions{})
		if err != nil {
			return fmt.Errorf("Failed to pull %s: %s", opts.Image, err)
		}
		err = ipResp.Wait(context.Background())
		if err != nil {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Set chaincode.builder in the peer's core.yaml to a valid builder image
  2. Pass a non-empty opts.Image in DockerBuildOptions
  3. Verify GetDockerImageFromConfig is reading the intended config file
  4. Re-run the build after the image name is provided

Example fix

// before (core.yaml)
# chaincode:
#   builder: hyperledger/fabric-ccenv:latest
// after (core.yaml)
chaincode:
  builder: hyperledger/fabric-ccenv:latest
Defensive patterns

Strategy: validation

Validate before calling

img := opts.Image
if img == "" {
    img = viper.GetString("chaincode.builder")
}
if img == "" {
    return fmt.Errorf("no builder image: set chaincode.builder in core.yaml or pass opts.Image")
}

Try / catch

if err != nil && strings.Contains(err.Error(), "chaincode.builder") {
    return fmt.Errorf("configure chaincode.builder (e.g. hyperledger/fabric-ccenv:latest) and retry")
}

Prevention

When it happens

Trigger: Calling DockerBuild with opts.Image == "" while the peer configuration 'chaincode.builder' is unset or resolves to an empty string.

Common situations: Deploying a peer without the chaincode.builder setting and calling platform util code that does not pass an explicit image; stripped-down configs where the default builder was removed.

Related errors


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