cloudflare/cloudflared · error

You must supply exactly one argument, either the ID or (cur

Error message

 You must supply exactly one argument, either the ID or (current) name of the virtual network to update

What it means

`cloudflared tunnel vnet update` requires exactly one positional argument identifying the virtual network (its ID or current name). updateVirtualNetworkCommand returns this error when the argument count is not exactly 1.

Source

Thrown at cmd/cloudflared/tunnel/vnets_subcommands.go:226

	forceDelete := false
	if c.IsSet(vnetForceDeleteFlag.Name) {
		forceDelete = c.Bool(vnetForceDeleteFlag.Name)
	}

	if err := sc.deleteVirtualNetwork(vnetId, forceDelete); err != nil {
		return errors.Wrap(err, "API error")
	}
	fmt.Printf("Successfully deleted virtual network '%s'\n", input)
	return nil
}

func updateVirtualNetworkCommand(c *cli.Context) error {
	sc, err := newSubcommandContext(c)
	if err != nil {
		return err
	}
	if c.NArg() != 1 {
		return errors.New(" You must supply exactly one argument, either the ID or (current) name of the virtual network to update")
	}

	input := c.Args().Get(0)
	vnetId, err := getVnetId(sc, input)
	if err != nil {
		return err
	}

	updates := cfapi.UpdateVirtualNetwork{}

	if c.IsSet(newNameFlag.Name) {
		newName := c.String(newNameFlag.Name)
		updates.Name = &newName
	}
	if c.IsSet(newCommentFlag.Name) {
		newComment := c.String(newCommentFlag.Name)
		updates.Comment = &newComment
	}

View on GitHub (pinned to 2253eeeb25)

Solutions

  1. Supply exactly one identifier and use flags for changes: `cloudflared tunnel vnet update my-vnet --name new-name`
  2. Quote vnet names containing spaces: `cloudflared tunnel vnet update "my vnet" --name "new name"`
  3. Check `cloudflared tunnel vnet update --help` to confirm which mutations are flag-driven

Example fix

// before
$ cloudflared tunnel vnet update old-name new-name
// error: You must supply exactly one argument...
// after
$ cloudflared tunnel vnet update old-name --name new-name
Defensive patterns

Strategy: validation

Validate before calling

# exactly one identifier; changes go through flags
[ $# -eq 1 ] || { echo "usage: cloudflared tunnel vnet update <ID|NAME> [--name NEW]"; exit 1; }
cloudflared tunnel vnet update "$1" --name "$NEW_NAME"

Prevention

When it happens

Trigger: Running `cloudflared tunnel vnet update` with zero arguments or with two or more positional arguments (e.g. passing both old and new names positionally instead of using --name).

Common situations: Passing the new name as a second positional argument instead of the --name flag; forgetting the identifier entirely; unquoted names with spaces creating multiple arguments.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06). Data as JSON: /api/errors/df8f00d436af10be. Report an issue: GitHub.