{"record":{"id":"fdd878711112473f","repo":"docker/cli","slug":"tag-can-t-be-used-with-all-tags-a","errorCode":null,"errorMessage":"tag can't be used with --all-tags/-a","messagePattern":"tag can't be used with --all-tags/-a","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/image/pull.go","lineNumber":75,"sourceCode":"\t// TODO(thaJeztah): DEPRECATED: remove in v29.1 or v30\n\tflags.Bool(\"disable-content-trust\", true, \"Skip image verification (deprecated)\")\n\t_ = flags.MarkDeprecated(\"disable-content-trust\", \"support for docker content trust was removed\")\n\n\tflags.StringVar(&opts.platform, \"platform\", os.Getenv(\"DOCKER_DEFAULT_PLATFORM\"), \"Set platform if server is multi-platform capable\")\n\t_ = flags.SetAnnotation(\"platform\", \"version\", []string{\"1.32\"})\n\t_ = cmd.RegisterFlagCompletionFunc(\"platform\", completion.Platforms())\n\n\treturn cmd\n}\n\n// runPull performs a pull against the engine based on the specified options\nfunc runPull(ctx context.Context, dockerCLI command.Cli, opts pullOptions) error {\n\tdistributionRef, err := reference.ParseNormalizedNamed(opts.remote)\n\tswitch {\n\tcase err != nil:\n\t\treturn err\n\tcase opts.all && !reference.IsNameOnly(distributionRef):\n\t\treturn errors.New(\"tag can't be used with --all-tags/-a\")\n\tcase !opts.all && reference.IsNameOnly(distributionRef):\n\t\tdistributionRef = reference.TagNameOnly(distributionRef)\n\t\tif tagged, ok := distributionRef.(reference.Tagged); ok && !opts.quiet {\n\t\t\t_, _ = fmt.Fprintln(dockerCLI.Out(), \"Using default tag:\", tagged.Tag())\n\t\t}\n\t}\n\n\tvar ociPlatforms []ocispec.Platform\n\tif opts.platform != \"\" {\n\t\t// TODO(thaJeztah): add a platform option-type / flag-type.\n\t\tp, err := platforms.Parse(opts.platform)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tociPlatforms = append(ociPlatforms, p)\n\t}\n\n\tencodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCLI.ConfigFile(), distributionRef.String())","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/image/pull.go#L57-L93","documentation":"runPull() validates the reference against --all-tags semantics: -a pulls every tag in a repository, which only makes sense for a name-only reference (IsNameOnly). If the user gave a specific tag (or digest) AND -a, the combination is contradictory and rejected before contacting the registry.","triggerScenarios":"`docker pull -a myimage:latest` or `docker pull --all-tags myimage@sha256:...`.","commonSituations":"Combining -a with an explicit tag/digest by habit; copy-pasting a tagged reference into an all-tags command.","solutions":["Drop the tag to pull all tags: `docker pull -a myimage`","Drop -a to pull a single tag: `docker pull myimage:latest`","Pick one intent (all tags vs one tag) and align the flags"],"exampleFix":"// before\ndocker pull -a myimage:latest\n// after\ndocker pull -a myimage","handlingStrategy":"validation","validationCode":"ref, err := reference.ParseNormalizedNamed(opts.remote)\nif err != nil { return err }\nif opts.all && !reference.IsNameOnly(ref) {\n    return errors.New(\"--all-tags requires a name-only reference without tag/digest\")\n}","typeGuard":"func isNameOnlyRef(s string) bool {\n    ref, err := reference.ParseNormalizedNamed(s)\n    if err != nil { return false }\n    return reference.IsNameOnly(ref)\n}","tryCatchPattern":null,"preventionTips":["Use -a only with a bare repository name (no :tag or @digest)","Validate the reference is name-only before combining with --all-tags","Decide between all-tags and a specific tag; never both"],"tags":["images","registry","cli","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}