{"record":{"id":"72ea46537552a74d","repo":"docker/cli","slug":"no-tag-specified-for-s","errorCode":null,"errorMessage":"no tag specified for %s","messagePattern":"no tag specified for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/docker-trust/trust/sign.go","lineNumber":141,"sourceCode":"\terr = trust.AddToAllSignableRoles(notaryRepo, &target)\n\tif err == nil {\n\t\tprettyPrintExistingSignatureInfo(out, existingSigInfo)\n\t\terr = notaryRepo.Publish()\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to sign %s:%s: %w\", imgRefAndAuth.RepoInfo().Name.Name(), tag, err)\n\t}\n\t_, _ = fmt.Fprintf(out, \"Successfully signed %s:%s\\n\", imgRefAndAuth.RepoInfo().Name.Name(), tag)\n\treturn nil\n}\n\nfunc validateTag(imgRefAndAuth trust.ImageRefAndAuth) error {\n\ttag := imgRefAndAuth.Tag()\n\tif tag == \"\" {\n\t\tif imgRefAndAuth.Digest() != \"\" {\n\t\t\treturn errors.New(\"cannot use a digest reference for IMAGE:TAG\")\n\t\t}\n\t\treturn fmt.Errorf(\"no tag specified for %s\", imgRefAndAuth.Name())\n\t}\n\treturn nil\n}\n\nfunc checkLocalImageExistence(ctx context.Context, apiClient client.APIClient, imageName string) error {\n\t_, err := apiClient.ImageInspect(ctx, imageName)\n\treturn err\n}\n\nfunc createTarget(notaryRepo notaryclient.Repository, tag string) (notaryclient.Target, error) {\n\ttarget := &notaryclient.Target{}\n\tvar err error\n\tif tag == \"\" {\n\t\treturn *target, errors.New(\"no tag specified\")\n\t}\n\ttarget.Name = tag\n\ttarget.Hashes, target.Length, err = getSignedManifestHashAndSize(notaryRepo, tag)\n\treturn *target, err","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cmd/docker-trust/trust/sign.go#L123-L159","documentation":"Returned by validateTag() in `docker trust sign` when the supplied image reference has no tag component and is not a digest reference. The command requires IMAGE:TAG because trust data is keyed per tag; signing an untagged 'latest-ish' reference is ambiguous and refused. %s is imgRefAndAuth.Name().","triggerScenarios":"Invoking `docker trust sign myimage` (no tag) or `docker trust sign registry.example.com/myrepo` where the reference parser yields an empty Tag() and empty Digest(). Distinct from the digest case (sign.go:139) which returns 'cannot use a digest reference'.","commonSituations":"User habitually omits tags expecting 'latest'; copy-pasting a repository URL without a tag; CI script interpolating an empty $TAG variable.","solutions":["Append an explicit tag: `docker trust sign <image>:<tag>`.","If the tag lives in a shell variable, verify it is non-empty before invoking the command.","Tag the image first with `docker tag <image> <image>:<tag>` if needed, then sign."],"exampleFix":"// before\n$ docker trust sign registry.example.com/app\nError: no tag specified for registry.example.com/app\n\n// after\n$ docker trust sign registry.example.com/app:v1","handlingStrategy":"validation","validationCode":"// Validate an explicit tag is present before invoking sign\nimport \"github.com/distribution/reference\"\n\nfunc ensureTagged(imageRef string) error {\n    ref, err := reference.ParseNormalizedNamed(imageRef)\n    if err != nil { return err }\n    if _, ok := ref.(reference.NamedTagged); !ok {\n        return fmt.Errorf(\"reference %s has no tag; pass <image>:<tag>\", imageRef)\n    }\n    return nil\n}","typeGuard":"// Type guard narrowing a parsed reference to one carrying a tag\nfunc hasTag(r reference.Reference) bool {\n    _, ok := r.(reference.NamedTagged)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Always specify <image>:<tag> explicitly; never rely on implicit 'latest'.","Fail CI fast if the tag variable is empty before the sign step.","Distinguish digest references — they are also rejected for signing."],"tags":["docker","trust","validation","image-reference"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}