hyperledger/fabric · error

Failed to wait pull %s: %s

Error message

Failed to wait pull %s: %s

What it means

After ImagePull succeeds, DockerBuild waits for the pull response stream to finish via ipResp.Wait. This error means the pull started but did not complete successfully — the stream ended with an error (e.g. manifest/layer failure or context cancellation). The builder image may be partially pulled or missing.

Source

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

		}
	}

	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 {
			return fmt.Errorf("Failed to wait pull %s: %s", opts.Image, err)
		}
	}

	// -----------------------------------------------------------------------------------
	// Create an ephemeral container, armed with our Image/Cmd
	// -----------------------------------------------------------------------------------
	container, err := client.ContainerCreate(context.Background(), dcli.ContainerCreateOptions{
		Config: &dcontainer.Config{
			AttachStdout: true,
			AttachStderr: true,
			Env:          opts.Env,
			Cmd:          []string{"/bin/sh", "-c", opts.Cmd},
			Image:        opts.Image,
		},
	})
	if err != nil {
		return fmt.Errorf("Error creating container: %s", err)
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Retry the operation; transient layer download failures often resolve
  2. Use a context with an adequate timeout (or context.Background) for the pull
  3. Verify disk space on the docker host for layer extraction
  4. Pre-pull the image manually with docker pull to stabilize
Defensive patterns

Strategy: retry

Validate before calling

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
// pass this ctx to DockerBuild-dependent calls so the pull can complete

Try / catch

if err != nil && strings.HasPrefix(err.Error(), "Failed to wait pull") {
    // pull started but failed mid-stream: retry with longer timeout
    return retryWithBackoff(func() error { return util.DockerBuild(opts, client) }, 3)
}

Prevention

When it happens

Trigger: client.ImagePull succeeds initially but ipResp.Wait(context) returns an error during layer download/extraction, or the context is cancelled/times out mid-pull.

Common situations: Flaky networks interrupting large layer downloads, registry returning errors mid-stream, or callers passing short-lived contexts that expire during the pull.

Related errors


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