cloudflare/cloudflared · error

unable to find route for provided network and vnet

Error message

unable to find route for provided network and vnet

What it means

getRouteId lists WARP routing (teamnet) routes filtered by network CIDR and virtual network, and expects exactly one match. If the filtered result count is not 1 (route absent, duplicated, or listing failed to narrow results), it returns "unable to find route for provided network and vnet".

Source

Thrown at cmd/cloudflared/tunnel/subcommand_context_teamnet.go:62

}

func (sc *subcommandContext) getRouteId(network net.IPNet, vnetId *uuid.UUID) (uuid.UUID, error) {
	filters := cfapi.NewIPRouteFilter()
	filters.NotDeleted()
	filters.NetworkIsSubsetOf(network)
	filters.NetworkIsSupersetOf(network)

	if vnetId != nil {
		filters.VNetID(*vnetId)
	}

	result, err := sc.listRoutes(filters)
	if err != nil {
		return uuid.Nil, err
	}

	if len(result) != 1 {
		return uuid.Nil, errors.New("unable to find route for provided network and vnet")
	}

	return result[0].ID, nil
}

View on GitHub (pinned to 2253eeeb25)

Solutions

  1. Run `cloudflared tunnel route ip show` to list existing routes and verify the exact CIDR and vnet.
  2. Pass --vnet with the correct virtual network ID or name.
  3. Confirm the route still exists; recreate it with `cloudflared tunnel route ip add <cidr> <tunnel>` if missing.

Example fix

// before
cloudflared tunnel route ip delete 10.0.0.0/8
// after
cloudflared tunnel route ip delete 10.0.0.0/8 --vnet default
Defensive patterns

Strategy: validation

Validate before calling

_, _, err := net.ParseCIDR(cidr)
if err != nil {
    return fmt.Errorf("invalid CIDR %q: %w", cidr, err)
}
// then: cloudflared tunnel route ip show, and confirm exactly one matching row exists

Prevention

When it happens

Trigger: Calling `cloudflared tunnel route ip delete <cidr>` (or similar) where no route exists for the given CIDR+vnet, or more than one route matches the filter (e.g. same CIDR on different vnets without --vnet specified).

Common situations: Typo in CIDR or vnet name/ID; route was already deleted; route exists under a different virtual network; ambiguous routes across multiple vnets.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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