pulumi/pulumi · error

the tag command does not accept versions

Error message

the tag command does not accept versions

What it means

`esc env tag mv` (rename a tag) does not operate on revisions, so a version-qualified environment reference is rejected. After resolving args via getExistingEnvRef, a non-empty ref.version yields this error before validating the tag name arguments.

Source

Thrown at pkg/cmd/esc/cli/env_tag_mv.go:48

		Args:    cobra.ExactArgs(3),
		Short:   "Move an environment tag",
		Long: "Move an environment tag\n" +
			"\n" +
			"This command updates a tag with the given name on the specified environment, " +
			"changing it's name.\n",
		RunE: func(cmd *cobra.Command, args []string) error {
			ctx := cmd.Context()

			if err := env.esc.getCachedClient(ctx); err != nil {
				return err
			}

			ref, args, err := env.getExistingEnvRef(ctx, args)
			if err != nil {
				return err
			}
			if ref.version != "" {
				return errors.New("the tag command does not accept versions")
			}

			name := args[0]
			newName := args[1]
			if name == "" {
				return errors.New("environment tag name cannot be empty")
			}
			if newName == "" {
				return errors.New("environment tag value cannot be empty")
			}

			tag, err := env.esc.client.GetEnvironmentTag(ctx, ref.orgName, ref.projectName, ref.envName, name)
			if err != nil {
				return err
			}

			st := style.NewStylist(style.Profile(env.esc.stdout))

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Use the unversioned environment reference: esc env tag mv org/project/env old new
  2. Strip the @version segment before invoking the command
  3. Rename tags once at the environment level; the change applies to the environment resource, not revisions

Example fix

// before
esc env tag mv org/proj/env@v2 owner team
// after
esc env tag mv org/proj/env owner team
Defensive patterns

Strategy: validation

Validate before calling

ref="$1"; case "$ref" in *@*) echo "strip the @version suffix for tag mv"; exit 1;; esac

Type guard

func hasVersion(ref string) bool { return strings.Contains(ref, "@") }

Prevention

When it happens

Trigger: Running `esc env tag mv <org>/<project>/<env>@<version> <oldName> <newName>` — any `@version` suffix in the environment reference.

Common situations: Script reuse from version-aware env commands; assuming tag renames are version-scoped like environment content; a shared REF variable that includes @latest.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/69c31946b7252ec7. Report an issue: GitHub.