Repository navigation
error parsing HTTP 401 response body: unexpected end of JSON input: "" #1293
Description
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
$ podman tag 6dbb9cc54074 namespace/i-have-no-perms-to
$ podman push namespace/i-have-no-perms-to --log-level=debug
Getting image source signatures
DEBU[0000] Manifest has MIME type application/vnd.docker.distribution.manifest.v2+json, ordered candidate list [application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.v1+prettyjws, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v1+json]
DEBU[0000] ... will first try using the original manifest unmodified
DEBU[0000] Checking /v2/namespace/i-have-no-perms-to/blobs/sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116
DEBU[0000] GET https://registry-1.docker.io/v2/
DEBU[0000] Ping https://registry-1.docker.io/v2/ status 401
DEBU[0000] GET https://auth.docker.io/token?scope=repository%3Anamespace%2Fi-have-no-perms-to%3Apull%2Cpush&service=registry.docker.io
DEBU[0001] HEAD https://registry-1.docker.io/v2/namespace/i-have-no-perms-to/blobs/sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116
DEBU[0001] ... not authorized
Error: error copying image to the remote destination: Error trying to reuse blob sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116 at destination: Error checking whether a blob sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116 exists in docker.io/namespace/i-have-no-perms-to: errors:
denied: requested access to the resource is denied
error parsing HTTP 401 response body: unexpected end of JSON input: ""
Describe the results you received:
error parsing HTTP 401 response body: unexpected end of JSON input: ""
Describe the results you expected:
HEAD request is issued to this endpoint https://registry-1.docker.io/v2/namespace/i-have-no-perms-to/blobs/sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116, which obviously does not contain response body. Client should be able to handle that and finish push operation without parsing errors
Additional information you deem important (e.g. issue happens only occasionally):
Output of podman version:
$ podman version
Version: 2.2.1
API Version: 2.1.0
Go Version: go1.14.10
Built: Tue Dec 8 14:37:43 2020
OS/Arch: linux/amd64
Output of podman info --debug:
$ podman info --debug
host:
arch: amd64
buildahVersion: 1.18.0
cgroupManager: systemd
cgroupVersion: v2
conmon:
package: conmon-2.0.26-1.fc32.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.0.26, commit: 74feb474bea20d593dfb70e1e244893b9eb6b619'
cpus: 2
distribution:
distribution: fedora
version: "32"
eventLogger: journald
hostname: example.com
idMappings:
gidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 65536
uidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 100000
size: 65536
kernel: 5.6.6-300.fc32.x86_64
linkmode: dynamic
memFree: 1871626240
memTotal: 4118777856
ociRuntime:
name: crun
package: crun-0.17-1.fc32.x86_64
path: /usr/bin/crun
version: |-
crun version 0.17
commit: 0e9229ae34caaebcb86f1fde18de3acaf18c6d9a
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
os: linux
remoteSocket:
path: /run/user/1000/podman/podman.sock
rootless: true
slirp4netns:
executable: /usr/bin/slirp4netns
package: slirp4netns-1.1.8-1.fc32.x86_64
version: |-
slirp4netns version 1.1.8
commit: d361001f495417b880f20329121e3aa431a8f90f
libslirp: 4.3.1
SLIRP_CONFIG_VERSION_MAX: 3
libseccomp: 2.4.2
swapFree: 0
swapTotal: 0
uptime: 34m 35.25s
registries:
search:
- registry.fedoraproject.org
- registry.access.redhat.com
- registry.centos.org
- docker.io
store:
configFile: /home/vagrant/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions:
overlay.mount_program:
Executable: /usr/bin/fuse-overlayfs
Package: fuse-overlayfs-1.4.0-1.fc32.x86_64
Version: |-
fusermount3 version: 3.9.1
fuse-overlayfs: version 1.4
FUSE library version 3.9.1
using FUSE kernel interface version 7.31
graphRoot: /home/vagrant/.local/share/containers/storage
graphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "false"
Supports d_type: "true"
Using metacopy: "false"
imageStore:
number: 15
runRoot: /run/user/1000/containers
volumePath: /home/vagrant/.local/share/containers/storage/volumes
version:
APIVersion: 2.1.0
Built: 1607438263
BuiltTime: Tue Dec 8 14:37:43 2020
GitCommit: ""
GoVersion: go1.14.10
OsArch: linux/amd64
Version: 2.2.1
Package info (e.g. output of rpm -q podman or apt list podman):
podman-2.2.1-1.fc32.x86_64
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes/No
Additional environment details (AWS, VirtualBox, physical, etc.):
Activity
mheon commentedon May 12, 2021
github-actions commentedon Jun 12, 2021
A friendly reminder that this issue had no activity for 30 days.
ipanova commentedon Jun 14, 2021
podman-3.3.0-0.5.dev.gited983c9.fc35.x86_64
mheon commentedon Jun 14, 2021
@vrothberg This one looks like a potential c/image issue, but I think it also ties into the image library error consistency work we want to do - this should probably return some sort of consistent error message indicating we have no permission to push?
baude commentedon Jul 2, 2021
@vrothberg wdyt?
vrothberg commentedon Jul 6, 2021
I think this is c/image only. FWIW, the parsing error seems to relate to Docker Hub. Pushing to Quay doesn't yield it.
@mtrmac shall we move the issue over to c/image?
mtrmac commentedon Jul 7, 2021
I would expect this to run into https://github.com/distribution/distribution/blob/01f589cf8726565aa3c5c053be12873bafedbedc/registry/client/errors.go#L127 , which is also the package where it fails. Something weird is going on.
Sure, move it — if we are going to add a work-around, it will be in c/image.
mtrmac commentedon Jul 7, 2021
The Immediate Cause
Example, with response dump:
and the presence of
WWW-Authenticatemeans we end up at https://github.com/distribution/distribution/blob/01f589cf8726565aa3c5c053be12873bafedbedc/registry/client/errors.go#L123 , not a few lines below as I have speculated above.UI Intent
Note the
errors:\ndenied: …text; the returned value is anerrcode.Errorsmulti-error list, and this multi-valued reporting seems to be a sort of intentional design of distribution/distribution error reporting; compare podman-container-tools/podman#10858 (comment) also returning a two-value list.The counterpart to this is how the Docker caller of that, at the top level (
TranslatePullError) just returns the first element (recursively); which is why no-one has probably noticed till now.API Evolution
On the one hand the current value is clearly not useful and using “the most relevant” error would make sense, OTOH there are already callers checking for various docker/distribution typed errors (for good reason), so stripping data might break some of them.
Well, the most direct way to fix that is probably in the distribution/distribution error parser — and then update to the new repo from docker/distribution to distribution/distribution, which breaks callers’ type checks just the same. Sigh…
errcode.Errorsand beautify that, without actually breaking the c/image API.@vrothberg , others: WDYT?
vrothberg commentedon Jul 8, 2021
Thanks for the wonderful summary, @mtrmac!
I am in favor of moving to distribution/distribution. I just wanted to browse the repository and noticed that docker/distribution is now forwarding to distribution/distribution. I could swear this was not the case two days ago, where I believe to have seen a "this repository is archived" banner.
Moving over to distribution/distribution and updating the containers ecosystem to me sounds like a good way forward. We should also document that the values are not an API promise. If needed we could selectively add some errors to c/image that would give promises.
mtrmac commentedon Feb 1, 2022
FWIW #1299 will follow Docker in only reporting the first error from a multi-error list.
ttys3 commentedon Aug 12, 2022
I got lots of this very day with podman:
but I do have permission. retry again it works
the registry server is harbor registry
My colleagues use docker does not have this issue
mtrmac commentedon Oct 12, 2022
Current failure text:
davidesalerno commentedon Feb 9, 2023
I have the same @mtrmac's issue with podman and buildah inside a pod
mtrmac commentedon Feb 9, 2023
@davidesalerno As noted above, at least the errors should no longer say “unexpected end of JSON input” in the originally-investigated scenarios.
If you still see that text with a recent version, please file a separate issue, with version numbers, the full error message, and ideally a
--debug/--log-level=debuglog.MehdiSellamiAdministrator commentedon Mar 29, 2023
correctly according to the name of your docker hub repository.