Skip to content

cp -r fails with 'MANIFEST_UNKNOWN' #2148

Closed

Description

@megaprutser

What happened in your environment?

Since cosign copy tells me to use oras cp -r instead, I started testing oras. But the copy of the GitLab images fail with a 'maninfest unknown'.

When doing the copy without the -r, the copy succeeds but no signature is copied.

When doing the copy -r again after that, the copy succeeds but still no signature is copied.

What did you expect to happen?

A succesfull copy of GitLab registry images, including signatures so we can verify images with cosign.

How can we reproduce it?

  • Start a registry (tested with harbor and docker registry)
docker run -p 5000:5000 --restart always --name registry registry:3
  • Copy registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ee:v19.3.0 to the registry
oras cp -dr --to-insecure registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ee:v19.3.0 localhost:5000/gitlab-workhorse-ee:v19.3.0 > cp-r_1.txt 2>&1
  • See the 'manifest unknown' error
{"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown","detail":"unknown tag=sha256-11e4068791cb99f2871ddbbeb5b3c213814a7cba4299d33acc5d31b1171064cb"}]}

Attached the logfile of the copy -rd

Copy with oras cp -dr fails
cp-r_1.txt

Copy with oras cp -d succeeds
cp.txt

Copy with oras cp -dr succeeds, but no signature
cp-r_2.txt

What is the version of your ORAS CLI?

Version: 1.3.4
Go version: go1.25.14
OS/Arch: windows/amd64
Git commit: db9e295
Git tree state: clean

What is your OS environment?

Windows 11 (git bash)

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Activity

  1. added
    bug
    triage
    on Aug 31, 2026
  2. megaprutser commented on Aug 31, 2026

    @megaprutser
    Author

    Ps. The image does have a signature

    https://docs.gitlab.com/charts/installation/verify_cng_images/

    cosign verify --key gl-cosign.pub registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ee:v19.3.0
    
    Verification for registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ee:v19.3.0 --
    The following checks were performed on each of these signatures:
      - The cosign claims were validated
      - Existence of the claims in the transparency log was verified offline
      - The signatures were verified against the specified public key
    
    [{"critical":{"identity":{"docker-reference":"dev.gitlab.org:5005/gitlab/charts/components/images/gitlab-workhorse-ee"},"image":{"docker-manifest-digest":"sha256:11e4068791cb99f2871ddbbeb5b3c213814a7cba4299d33acc5d31b1171064cb"},"type":"cosign container image signature"},"optional":{"Bundle":{"SignedEntryTimestamp":"MEQCIBjkFsVa/sRosvWQD9bhS158cV2Wf+zslSyd1FSUVWk9AiAKoyWfa5yIi6TicqHQZCfW2oB6bIr92b7oXrh2CT2KXQ==","Payload":{"body":"eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiJjZmM2MjQ5ODExMGE2MjI4NDE3NjBmOGRiOThlYTU5NDVlMTE1ZDA5NDIzYTk2Yjg3ZWIyYTVmMmNmOGViYzg3In19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FUUNJQklSTFlPRUxQYWlnQTJKZ1ZDcWxJSGZJSWFFay9BcW8rQVhnMXVRU25hY0FpQkVvcE0zTTVRYW52aE9GbElaK2lOK09wc3ExMjdoaEM2dG9XVDMzMmg0MkE9PSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCUVZVSk1TVU1nUzBWWkxTMHRMUzBLVFVacmQwVjNXVWhMYjFwSmVtb3dRMEZSV1VsTGIxcEplbW93UkVGUlkwUlJaMEZGYnpGQk5tbEZjbXhrSzFoRU5WSTBiVXRNU1VGNU4wVXhOMlV3WXdwV1VWSldlVEpoTmpoSlRESklSaXRXV1VKeWFqRkpjbHAyT0ZsdU5UUTVaU3RUUVRVeVpVZHZLMEpIU1RWSWJVeGxVbXR2Wm5Ob1MxaG5QVDBLTFMwdExTMUZUa1FnVUZWQ1RFbERJRXRGV1MwdExTMHRDZz09In19fX0=","integratedTime":1787193859,"logIndex":2524733429,"logID":"c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"}}}}]
    
  3. TerryHowe commented on Sep 5, 2026

    @TerryHowe
    Member

    Thanks for the detailed logs — they made this one reproducible. There are two separate things going on here.

    1. The MANIFEST_UNKNOWN failure is a real bug

    GitLab's registry does not implement the Referrers API, so ORAS falls back to the referrers tag schema and requests sha256-<hex>. GitLab resolves that reference as if it were the digest sha256:<hex>, returning the image itself:

    $ curl -s -D- -o /dev/null -H "Authorization: Bearer $TOK" \
        "https://registry.gitlab.com/v2/gitlab-org/build/cng/gitlab-workhorse-ee/manifests/sha256-11e4068791cb99f2871ddbbeb5b3c213814a7cba4299d33acc5d31b1171064cb"
    HTTP/2 200
    content-type: application/vnd.docker.distribution.manifest.list.v2+json
    docker-content-digest: sha256:11e4068791cb99f2871ddbbeb5b3c213814a7cba4299d33acc5d31b1171064cb

    oras-go does not validate that response, so your image index's own child manifests come back as its "referrers". You can see it without copying anything:

    $ oras discover registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ee:v19.3.0
    registry.gitlab.com/…@sha256:11e4068791cb…
    └── <unknown>
        ├── sha256:246a3ea40233…   ← linux/arm64 child
        └── sha256:be904ba6967a…   ← linux/amd64 child

    With those bogus referrers in play, the extended copy walks the graph from the two child manifests instead of the index, so the index is never pushed — and the final tagging step fetches it from the destination, which is the 404 at the end of your cp-r_1.txt. That also explains why the second cp -r succeeded: your plain oras cp had already pushed the index.

    Filed upstream as oras-project/oras-go#1396, since the fix belongs in the referrers tag schema fallback. Confirmed on both oras-go v3 main and v2.6.2.

    Workaround until it lands: the plain oras cp you already ran copies the image correctly.

    2. The missing signature is expected, and unrelated

    Cosign stores that signature as a tag, not as an OCI referrer:

    $ curl -s -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $TOK" \
        "https://registry.gitlab.com/v2/…/manifests/sha256-11e4068791cb….sig"
    200

    Note the .sig suffix — that is cosign's own tag convention, and it is not discoverable through the Referrers API or the referrers tag schema. oras cp -r follows referrers, so it will never pick up cosign's tag-based signatures, on GitLab or anywhere else. Fixing #1396 will stop cp -r from failing, but it still will not bring the signature across.

    To copy the signature, either use cosign copy, or copy the signature tag explicitly:

    oras cp --to-insecure registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ee:sha256-11e4068791cb99f2871ddbbeb5b3c213814a7cba4299d33acc5d31b1171064cb.sig \
      localhost:5000/gitlab-workhorse-ee:sha256-11e4068791cb99f2871ddbbeb5b3c213814a7cba4299d33acc5d31b1171064cb.sig

    (The cosign copy deprecation notice pointing at oras cp -r is misleading for tag-based signatures — that suggestion only holds for signatures attached as OCI referrers.)

  4. TerryHowe commented on Sep 5, 2026

    @TerryHowe
    Member

    Some additional context for maintainers: this is the second time this exact failure shape has surfaced, and part of why it was hard to diagnose is that the error message points at the wrong side.

    This is the same failure mode as #1728

    #1728 ("Recursively copying a multi-platform image might fail when the index manifest has no referrer") failed with the same MANIFEST_UNKNOWN at the tagging step, via the same mechanism. The analysis in that issue applies verbatim here: referrers get injected as predecessors of the index, findRoots scans upward, the index is not among the roots, and so the index itself is never copied.

    The two are mirror images:

    That suggests the durable fix is not only validating the referrers response upstream (oras-project/oras-go#1396), but also making recursiveCopy guarantee the root is present in the destination before tagging it — a property that has now been violated twice by two unrelated causes. A oras.CopyGraph(ctx, src, dst, root, opts.CopyGraphOptions) before the dst.Tag at cmd/oras/root/cp.go:279 is close to free when the root is already there, and makes the command robust regardless of what FindPredecessors returns.

    The error message attributes a destination failure to the source

    Compare the two reports. #1728, on ORAS 1.3.0-beta.3:

    Error response from registry: failed to perform "Tag" on destination: sha256:1c955…: application/vnd.oci.image.index.v1+json: not found
    

    This issue, on ORAS 1.3.4:

    Error response from registry: sha256:11e4068…: not found
    

    Same failure, but on destination is gone. The 404 in cp-r_1.txt is GET http://localhost:5000/v2/gitlab-workhorse-ee/manifests/sha256:11e4068… — the local registry — yet the message gives no hint of that, which is a good part of why this reads as "the GitLab source is serving an unknown manifest."

    Two contributing spots:

    1. dst.Tag(ctx, root, dstRef) at cmd/oras/root/cp.go:279 is a bare call outside any copy operation, so its error never becomes an *oras.CopyError. BinaryTarget.ModifyError (cmd/oras/internal/option/binary_target.go:72-95) has a good path for copy errors — it reads copyErr.Origin and prefixes Error from destination registry for "…": — but that path needs a CopyError, so this error falls through to the generic handler.

    2. The generic handler then hands it to the wrong target. Target.ModifyError (cmd/oras/internal/option/target.go:251-255):

      if errors.Is(err, errdef.ErrNotFound) {
          // special handling for not found error returned by registry target
          cmd.SetErrPrefix(oerrors.RegistryErrorPrefix)
          return true, err
      }

      There is no host check here, unlike the errcode.ErrorResponse branch just below it (target.go:262-275), which compares errResp.URL.Host against the target's host before claiming the error. And binary_target.go:98-101 tries target.From first. So on any oras cp between two remote targets, a destination ErrNotFound is claimed by the source and printed with a generic, host-less prefix.

    This looks like leftover surface from #1469 / #1773 — the CopyError-aware prefixing added there is a real improvement, it just does not cover errors raised outside a copy operation.

    Happy to split the error-attribution part into its own issue if you would rather track it separately from the copy bug.

  5. TerryHowe commented on Sep 5, 2026

    @TerryHowe
    Member

    Split the error-attribution half of my previous comment into #2156, so this issue can stay focused on the copy bug.

    To summarize where the three threads now live:

    The missing cosign signature remains expected behavior, for the reason in my first comment: it is stored as a .sig tag, not as an OCI referrer, so -r will not copy it even once #1396 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions