diff --git a/cmd/oras/internal/option/packer.go b/cmd/oras/internal/option/packer.go index d32fa62de..ad633dd65 100644 --- a/cmd/oras/internal/option/packer.go +++ b/cmd/oras/internal/option/packer.go @@ -99,7 +99,13 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string } if opts.AnnotationFilePath != "" { if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil { - return nil, err + errStr := err.Error() + docLink := " Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations." + if !strings.HasSuffix(errStr, ".") { + docLink = "."+docLink + } + return nil, fmt.Errorf("failed to load annotations from %s: %w" + + docLink, opts.AnnotationFilePath, err) } } if len(opts.ManifestAnnotations) != 0 {