{"record":{"id":"c3518160b4d784d2","repo":"docker/cli","slug":"s-no-tag-or-digest","errorCode":null,"errorMessage":"%s no tag or digest","messagePattern":"(.+?) no tag or digest","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/registryclient/client.go","lineNumber":195,"sourceCode":"\tfetch := func(ctx context.Context, repo distribution.Repository, ref reference.Named) (bool, error) {\n\t\tvar err error\n\t\tresult, err = fetchList(ctx, repo, ref)\n\t\treturn len(result) > 0, err\n\t}\n\n\terr := c.iterateEndpoints(ctx, ref, fetch)\n\treturn result, err\n}\n\nfunc getManifestOptionsFromReference(ref reference.Named) (digest.Digest, []distribution.ManifestServiceOption, error) {\n\tif tagged, isTagged := ref.(reference.NamedTagged); isTagged {\n\t\ttag := tagged.Tag()\n\t\treturn \"\", []distribution.ManifestServiceOption{distribution.WithTag(tag)}, nil\n\t}\n\tif digested, isDigested := ref.(reference.Canonical); isDigested {\n\t\treturn digested.Digest(), []distribution.ManifestServiceOption{}, nil\n\t}\n\treturn \"\", nil, fmt.Errorf(\"%s no tag or digest\", ref)\n}\n","sourceCodeStart":177,"sourceCodeEnd":197,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/internal/registryclient/client.go#L177-L197","documentation":"getManifestOptionsFromReference returns this when the reference is neither NamedTagged nor Canonical — i.e. it carries only a name with no :tag and no @digest. The distribution manifest API needs a tag or digest to locate a manifest, so a bare name is unusable at this layer.","triggerScenarios":"Calling PutManifest (or getManifest via GetManifest/GetManifestList) with a reference like \"nginx\" or \"library/nginx\" that has no tag and no digest.","commonSituations":"Passing a bare image name expecting an implicit \"latest\"; programmatically trimming the tag off a ref; building a ref with reference.WithName and forgetting to attach a tag/digest.","solutions":["Attach a tag with reference.WithTag(name, \"latest\") or reference.WithTag(name, desiredTag).","Attach a digest with reference.WithDigest(name, dgst) for immutable pulls.","Validate with a type assertion to reference.NamedTagged or reference.Canonical before calling.","If the user supplied the value, surface a clear \"tag or digest required\" message upstream."],"exampleFix":"// before\nref, _ := reference.ParseNamed(\"library/nginx\")\nc.GetManifest(ctx, ref) // -> no tag or digest\n\n// after\nref, _ := reference.WithTag(reference.MustParseNamed(\"library/nginx\"), \"latest\")\nc.GetManifest(ctx, ref)","handlingStrategy":"validation","validationCode":"// Ensure the reference carries a tag or digest before calling the client.\nfunc ensureTaggedOrDigested(ref reference.Named) (reference.Named, error) {\n    switch r := ref.(type) {\n    case reference.NamedTagged, reference.Canonical:\n        return ref, nil\n    }\n    return reference.WithTag(ref, \"latest\")\n}","typeGuard":"func hasTagOrDigest(ref reference.Named) bool {\n    switch ref.(type) {\n    case reference.NamedTagged, reference.Canonical:\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":null,"preventionTips":["Always attach an explicit tag or digest; never rely on this layer to default to latest.","Construct refs with reference.WithTag / reference.WithDigest.","Validate at the input boundary and return a clear error to the user."],"tags":["docker","registry","reference","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}