{"record":{"id":"0a6fb13900a3cd74","repo":"GoogleContainerTools/skaffold","slug":"reading-image-q-w","errorCode":null,"errorMessage":"reading image %q: %w","messagePattern":"reading image %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/remote.go","lineNumber":110,"sourceCode":"func RetrieveRemoteConfig(identifier string, cfg Config, platform v1.Platform) (*v1.ConfigFile, error) {\n\timg, err := getRemoteImage(identifier, cfg, platform)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn img.ConfigFile()\n}\n\n// Push pushes the tarball image\nfunc Push(tarPath, tag string, cfg Config, platforms []specs.Platform) (string, error) {\n\tt, err := name.NewTag(tag, name.WeakValidation)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parsing tag %q: %w\", tag, err)\n\t}\n\n\ti, err := tarball.ImageFromPath(tarPath, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"reading image %q: %w\", tarPath, err)\n\t}\n\n\tif err := remote.Write(t, i, remote.WithAuthFromKeychain(primaryKeychain)); err != nil {\n\t\treturn \"\", fmt.Errorf(\"%s %q: %w\", sErrors.PushImageErr, t, err)\n\t}\n\n\treturn getRemoteDigest(tag, cfg, platforms)\n}\n\nfunc getRemoteImage(identifier string, cfg Config, platform v1.Platform) (v1.Image, error) {\n\tref, err := parseReference(identifier, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toptions := []remote.Option{\n\t\tremote.WithAuthFromKeychain(primaryKeychain),\n\t}\n\tif IsInsecure(ref, cfg.GetInsecureRegistries()) {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/remote.go#L92-L128","documentation":"Push loads the local image tarball with tarball.ImageFromPath and returns \"reading image %q\" when the file cannot be read or parsed as a Docker/OCI image archive. The wrapped error distinguishes filesystem problems (missing file, permissions) from format problems (invalid tar, no manifest.json).","triggerScenarios":"tarPath points to a nonexistent file or wrong path; the file is not a `docker save` archive (e.g. it's a single-layer tar, an OCI layout dir, or compressed); the archive's manifest.json is missing or corrupted.","commonSituations":"Build step silently failed so the .tar was never produced; passing a directory instead of a tar; passing a docker buildx output in OCI layout format where tarball.ImageFromPath expects docker-save format; partial download/truncated file.","solutions":["Verify the tarball exists and is non-empty: `ls -la <tarPath>`; if missing, fix the build step that produces it.","Check it's a docker-save archive: `tar -tf img.tar | grep manifest.json` — if absent, regenerate with `docker save -o img.tar <image>`.","If the source is an OCI layout, convert it first (e.g. `skopeo copy oci:dir docker-archive:img.tar`).","Confirm the file path passed is the file itself, not the containing directory.","Re-run the image build/save to rule out a truncated or corrupted archive."],"exampleFix":"// before\nos.IsDir check missing; digest, err := docker.Push(\"out/image\", tag, cfg, nil)\n// after\nif fi, err := os.Stat(\"out/image.tar\"); err != nil || fi.IsDir() { return fmt.Errorf(\"image tarball missing: out/image.tar\") }\ndigest, err := docker.Push(\"out/image.tar\", tag, cfg, nil)","handlingStrategy":"validation","validationCode":"func validateImageTar(path string) error {\n\tfi, err := os.Stat(path)\n\tif err != nil { return fmt.Errorf(\"tarball missing: %w\", err) }\n\tif fi.IsDir() || fi.Size() == 0 { return fmt.Errorf(\"%s is not a non-empty file\", path) }\n\tf, err := os.Open(path)\n\tif err != nil { return err }\n\tdefer f.Close()\n\ttr := tar.NewReader(f)\n\tfor {\n\t\th, err := tr.Next()\n\t\tif err == io.EOF { return errors.New(\"no manifest.json in archive\") }\n\t\tif err != nil { return err }\n\t\tif h.Name == \"manifest.json\" { return nil }\n\t}\n}","typeGuard":"func isDockerSaveTar(path string) bool { return validateImageTar(path) == nil }","tryCatchPattern":"if err := validateImageTar(tarPath); err != nil { return err }\nif _, err := docker.Push(tarPath, tag, cfg, platforms); err != nil {\n\tif strings.Contains(err.Error(), \"reading image\") {\n\t\treturn fmt.Errorf(\"%s is not a valid docker-save archive; regenerate with `docker save -o %s <image>`\", tarPath, tarPath)\n\t}\n\treturn err\n}","preventionTips":["Always produce the tarball with `docker save -o` before pushing.","Stat the file (exists, regular, non-empty) before calling Push.","Convert OCI layouts with skopeo before use — tarball.ImageFromPath expects docker-save format.","Fail the pipeline early if the producing build step reports any error."],"tags":["docker","filesystem","tarball","validation"],"backgroundTag":"invalid-image-tarball","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}