goharbor/harbor · error
failed to decode content: %w
Error message
failed to decode content: %w
What it means
Error "failed to decode content: %w" thrown in goharbor/harbor.
Source
Thrown at src/controller/artifact/processor/cnai/parser/base.go:90
// 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) {
format := filepath.Ext(mediaType)
switch format {
case formatTar:
return untar(reader, limit)
case formatRaw:
return readAllLimited(reader, limit)
default:
return nil, fmt.Errorf("unsupported format: %s", format)
}
}View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/controller/artifact/processor/cnai/parser/base.go:90 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/e0a809f534e0614e.
Report an issue: GitHub.