diff --git a/src/pkg/oci/fetch.go b/src/pkg/oci/fetch.go index a8bc049ca4..1b95e61efd 100644 --- a/src/pkg/oci/fetch.go +++ b/src/pkg/oci/fetch.go @@ -30,7 +30,10 @@ func (o *OrasRemote) ResolveRoot() (ocispec.Descriptor, error) { return desc, nil } - // if target platform is nil, oras.Resolve falls back to a o.repo.Resolve call + if o.targetPlatform == nil && desc.MediaType == ocispec.MediaTypeImageIndex { + return ocispec.Descriptor{}, fmt.Errorf("%q resolved to an image index, but no target platform was specified", o.repo.Reference.Reference) + } + resolveOpts := oras.ResolveOptions{ TargetPlatform: o.targetPlatform, }