Skip to content

Original exception is swallowed when attach command's user has not correct permissions #1695

@bedla

Description

@bedla

What happened in your environment?

Hi,
I have following command and when user I am using does not have correct permissions at Harbor, it returns 401.
Unfortunatelly I was only able to get this information during debugging session, not from console output.
Thank you
Ivos

Image

Code: 401
Message: unauthorized to access repository: personal-ivo_smid/gitlab-commithook-settings, action: push: unauthorized to access repository: personal-ivo_smid/gitlab-commithook-settings, action: push

and console output

What did you expect to happen?

No response

How can we reproduce it?

command to run (I assume that not all flags are necessary)

oras
attach
--artifact-type
application/vnd.cz.xxx.license-analyze-result.v1
--annotation-file
c:\Users\IVOMD~1\AppData\Local\Temp\oci-attacher18183237746840218121\annotations.json
--format
json
--disable-path-validation=true
harbor-aws.internal.xxx.tech/personal-ivo_smid/gitlab-commithook-settings:1.0-SNAPSHOT
c:\Users\IVOMD~1\AppData\Local\Temp\oci-attacher18183237746840218121\out-licence.json:application/json

console output is
Note: Once it happened, that I was able to get error message not panic.

panic: sync/atomic: compare and swap of inconsistently typed value into Value

goroutine 68 [running]:
sync/atomic.(*Value).CompareAndSwap(0xc000430150, {0x0, 0x0}, {0x1271e60, 0xc0004b43f0})
	C:/Users/IvoŠmíd/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.windows-amd64/src/sync/atomic/value.go:174 +0x30a
oras.land/oras-go/v2/internal/syncutil.Go[...].func1.1()
	C:/Users/IvoŠmíd/go/pkg/mod/oras.land/oras-go/v2@v2.5.1-0.20250221033735-cb6d75be7dd4/internal/syncutil/limit.go:86 +0x1ce
golang.org/x/sync/errgroup.(*Group).Go.func1()
	C:/Users/IvoŠmíd/go/pkg/mod/golang.org/x/sync@v0.13.0/errgroup/errgroup.go:79 +0xa9
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 38
	C:/Users/IvoŠmíd/go/pkg/mod/golang.org/x/sync@v0.13.0/errgroup/errgroup.go:76 +0xe8

Image

What is the version of your ORAS CLI?

$ docker run ghcr.io/oras-project/oras:main version
Version:        1.3.0-beta.2+unreleased
Go version:     go1.24.0
OS/Arch:        linux/amd64
Git commit:     6f04cf05b29fa8eb7dd0cc0b636d45fa716911d1
Git tree state: clean

What is your OS environment?

Docker

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions