{"record":{"id":"dfc8d2b1aaa2a5f1","repo":"GoogleContainerTools/skaffold","slug":"retrieving-labels-for-q-w","errorCode":null,"errorMessage":"retrieving labels for %q: %w","messagePattern":"retrieving labels for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/sync/sync.go","lineNumber":192,"sourceCode":"\t\tif a.CustomArtifact.Dependencies == nil || a.CustomArtifact.Dependencies.Dockerfile == nil {\n\t\t\treturn nil, build.ErrCustomBuildNoDockerfile{}\n\t\t}\n\t\treturn docker.SyncMap(ctx, a.Workspace, a.CustomArtifact.Dependencies.Dockerfile.Path, a.CustomArtifact.Dependencies.Dockerfile.BuildArgs, cfg)\n\n\tcase a.KanikoArtifact != nil:\n\t\treturn docker.SyncMap(ctx, a.Workspace, a.KanikoArtifact.DockerfilePath, a.KanikoArtifact.BuildArgs, cfg)\n\n\tdefault:\n\t\treturn nil, build.ErrSyncMapNotSupported{}\n\t}\n}\n\nfunc autoSyncItem(ctx context.Context, a *latest.Artifact, tag string, e filemon.Events, cfg docker.Config) (*Item, error) {\n\tswitch {\n\tcase a.BuildpackArtifact != nil:\n\t\tlabels, err := Labels(ctx, tag, cfg)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"retrieving labels for %q: %w\", tag, err)\n\t\t}\n\n\t\trules, err := buildpacks.SyncRules(labels)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"extracting sync rules from labels for %q: %w\", tag, err)\n\t\t}\n\n\t\treturn syncItem(ctx, a, tag, e, rules, cfg)\n\n\tcase a.JibArtifact != nil:\n\t\ttoCopy, toDelete, err := jib.GetSyncDiff(ctx, a.Workspace, a.JibArtifact, e)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif toCopy == nil && toDelete == nil {\n\t\t\t// do a rebuild\n\t\t\treturn nil, nil\n\t\t}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/sync/sync.go#L174-L210","documentation":"autoSyncItem syncs buildpack-built images by reading the image's OCI labels via Docker (Labels) to derive sync rules. If querying Docker for the image's labels fails, Skaffold wraps the error with this message, including the image tag.","triggerScenarios":"Syncing changes to an artifact with BuildpackArtifact set, when docker image inspect fails: the tagged image no longer exists locally, the Docker daemon is unreachable, or the tag reference is wrong/stale.","commonSituations":"Image was garbage-collected (prune) between build and first sync; DOCKER_HOST points at a different daemon than the one that built the image; a newer image was pushed and the old tag removed.","solutions":["Run `docker image inspect <tag>` with the tag from the error to confirm the image exists locally; rebuild via `skaffold dev` if missing","Check DOCKER_HOST / docker context to ensure the CLI talks to the same daemon used for the build","Re-run skaffold so a fresh build re-tags the image before sync runs"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"_, err := docker.Cli(cfg).ImageInspect(ctx, tag) // fails fast if image absent\nif err != nil { return fmt.Errorf(\"image %s missing; rebuild first\", tag) }","typeGuard":"func imageExists(ctx context.Context, cfg docker.Config, tag string) bool {\n    _, err := docker.Cli(cfg).ImageInspect(ctx, tag)\n    return err == nil\n}","tryCatchPattern":"item, err := sync.NewItem(ctx, a, tag, e, cfg, builds)\nif err != nil {\n    if strings.Contains(err.Error(), \"retrieving labels\") {\n        // rebuild and retry once\n        if rbErr := rebuild(ctx, a); rbErr == nil { return sync.NewItem(ctx, a, tag, e, cfg, builds) }\n    }\n    return err\n}","preventionTips":["Avoid aggressive docker image prune while skaffold dev is running","Keep DOCKER_HOST/docker context consistent between build and sync sessions","Re-run skaffold build after pulling/replacing images externally"],"tags":["skaffold","sync","docker","buildpacks","labels"],"backgroundTag":"docker-image-inspect-failed","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"}