goharbor/harbor · error

failed to pull blob from registry

Error message

failed to pull blob from registry: %w

What it means

Wrapping error in the CNAI parser base.Parse: the registry client PullBlob call for the artifact's layer blob failed. The %w carries the underlying cause - typically blob not found, registry connectivity failure, or auth rejection - so artifact content parsing aborts before decoding.

Solutions

  1. Verify the blob exists in the repository and the layer digest is correct.
  2. Check registry connectivity, credentials, and proxy configuration.
  3. Retry the parse; transient network failures are the common cause.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/controller/artifact/processor/cnai/parser/base.go:80 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/862e64023387e226. Report an issue: GitHub.

Appendix: source

Thrown at src/controller/artifact/processor/cnai/parser/base.go:80

}

// Parse is the common implementation for parsing layer.
func (b *base) Parse(_ context.Context, artifact *artifact.Artifact, layer *ocispec.Descriptor) (string, []byte, error) {
	if artifact == nil || layer == nil {
		return "", nil, fmt.Errorf("artifact or manifest cannot be nil")
	}

	// Reject early based on the manifest-declared size. This is only a cheap
	// pre-check: layer.Size is attacker-controlled and reflects the packed blob
	// size, which can be far smaller than the number of bytes materialized when
	// the content is decompressed/expanded (e.g. GNU tar sparse files).
	if layer.Size > defaultFileSizeLimit {
		return "", nil, errors.RequestEntityTooLargeError(errFileTooLarge)
	}

	_, stream, err := b.regCli.PullBlob(artifact.RepositoryName, layer.Digest.String())
	if err != nil {
		return "", nil, fmt.Errorf("failed to pull blob from registry: %w", err)
	}

	defer stream.Close()

	// Enforce the size limit against the actual bytes materialized, not just the
	// declared blob size, to prevent decompression/sparse-file bombs from
	// exhausting memory.
	content, err := decodeContent(layer.MediaType, stream, defaultFileSizeLimit)
	if err != nil {
		return "", nil, fmt.Errorf("failed to decode content: %w", err)
	}

	return contentTypeTextPlain, content, nil
}

// decodeContent decodes the content read from reader according to mediaType,
// enforcing that no more than limit bytes are materialized in memory.
func decodeContent(mediaType string, reader io.Reader, limit int64) ([]byte, error) {

View on GitHub (pinned to 7b2fd08cc5)