{"record":{"id":"862e64023387e226","repo":"goharbor/harbor","slug":"failed-to-pull-blob-from-registry-w","errorCode":null,"errorMessage":"failed to pull blob from registry: %w","messagePattern":"failed to pull blob from registry: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/controller/artifact/processor/cnai/parser/base.go","lineNumber":80,"sourceCode":"}\n\n// Parse is the common implementation for parsing layer.\nfunc (b *base) Parse(_ context.Context, artifact *artifact.Artifact, layer *ocispec.Descriptor) (string, []byte, error) {\n\tif artifact == nil || layer == nil {\n\t\treturn \"\", nil, fmt.Errorf(\"artifact or manifest cannot be nil\")\n\t}\n\n\t// Reject early based on the manifest-declared size. This is only a cheap\n\t// pre-check: layer.Size is attacker-controlled and reflects the packed blob\n\t// size, which can be far smaller than the number of bytes materialized when\n\t// the content is decompressed/expanded (e.g. GNU tar sparse files).\n\tif layer.Size > defaultFileSizeLimit {\n\t\treturn \"\", nil, errors.RequestEntityTooLargeError(errFileTooLarge)\n\t}\n\n\t_, stream, err := b.regCli.PullBlob(artifact.RepositoryName, layer.Digest.String())\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"failed to pull blob from registry: %w\", err)\n\t}\n\n\tdefer stream.Close()\n\n\t// Enforce the size limit against the actual bytes materialized, not just the\n\t// declared blob size, to prevent decompression/sparse-file bombs from\n\t// exhausting memory.\n\tcontent, err := decodeContent(layer.MediaType, stream, defaultFileSizeLimit)\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"failed to decode content: %w\", err)\n\t}\n\n\treturn contentTypeTextPlain, content, nil\n}\n\n// decodeContent decodes the content read from reader according to mediaType,\n// enforcing that no more than limit bytes are materialized in memory.\nfunc decodeContent(mediaType string, reader io.Reader, limit int64) ([]byte, error) {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/artifact/processor/cnai/parser/base.go#L62-L98","documentation":"Error \"failed to pull blob from registry: %w\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/controller/artifact/processor/cnai/parser/base.go:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}