cloudflare/cloudflared · error

Can't get tunnel information. Please check tunnel id: %s

Error message

Can't get tunnel information. Please check tunnel id: %s

What it means

cloudflared wraps any failure from the Cloudflare Tunnel Store API `GetTunnel(id)` call when resolving each tunnel ID during `cloudflared tunnel delete`. The tunnel could not be fetched, so the delete is aborted for that ID. It indicates the API request itself failed (network, auth, or the ID does not exist) rather than a local file problem.

Source

Thrown at cmd/cloudflared/tunnel/subcommand_context.go:222

	client, err := sc.client()
	if err != nil {
		return nil, err
	}
	return client.ListTunnels(filter)
}

func (sc *subcommandContext) delete(tunnelIDs []uuid.UUID) error {
	forceFlagSet := sc.c.Bool(cfdflags.Force)

	client, err := sc.client()
	if err != nil {
		return err
	}

	for _, id := range tunnelIDs {
		tunnel, err := client.GetTunnel(id)
		if err != nil {
			return errors.Wrapf(err, "Can't get tunnel information. Please check tunnel id: %s", id)
		}

		// Check if tunnel DeletedAt field has already been set
		if !tunnel.DeletedAt.IsZero() {
			return fmt.Errorf("Tunnel %s has already been deleted", tunnel.ID)
		}

		if err := client.DeleteTunnel(tunnel.ID, forceFlagSet); err != nil {
			return errors.Wrapf(err, "Error deleting tunnel %s", tunnel.ID)
		}

		credFinder := sc.credentialFinder(id)
		if tunnelCredentialsPath, err := credFinder.Path(); err == nil {
			if err = os.Remove(tunnelCredentialsPath); err != nil {
				sc.log.Info().Msgf("Tunnel %v was deleted, but we could not remove its credentials file  %s: %s. Consider deleting this file manually.", id, tunnelCredentialsPath, err)
			}
		}
	}

View on GitHub (pinned to 2253eeeb25)

Solutions

  1. Verify the tunnel exists: `cloudflared tunnel list` and confirm the exact ID
  2. Run `cloudflared tunnel info <id>` to test API connectivity/auth for that ID
  3. Check that a valid origin certificate exists (`cloudflared tunnel login`) or pass --origincert
  4. Check network/proxy reachability to the API (or --api-url value) and retry
  5. If the tunnel is actually gone, remove the stale credentials file manually and skip deleting that ID

Example fix

// before (fails on one bad ID among many)
for _, id := range tunnelIDs {
    tunnel, err := client.GetTunnel(id)
    if err != nil {
        return errors.Wrapf(err, "Can't get tunnel information. Please check tunnel id: %s", id)
    }
    ...
}
// after (log and continue with remaining IDs)
for _, id := range tunnelIDs {
    tunnel, err := client.GetTunnel(id)
    if err != nil {
        sc.log.Error().Err(err).Str("tunnelID", id.String()).Msg("Can't get tunnel information, skipping")
        continue
    }
    ...
}
Defensive patterns

Strategy: try-catch

Validate before calling

out, err := exec.Command("cloudflared", "tunnel", "list").Output()
if err != nil { /* API/auth problem — fix before delete */ }
exists := strings.Contains(string(out), tunnelID)
if !exists { return fmt.Errorf("tunnel %s not found", tunnelID) }

Type guard

func tunnelIDLooksValid(id string) bool {
    _, err := uuid.Parse(id)
    return err == nil
}

Try / catch

if err := run("cloudflared", "tunnel", "delete", id); err != nil {
    if strings.Contains(err.Error(), "Can't get tunnel information") {
        // treat as not-found or auth issue; check `tunnel list` and cert
    }
}

Prevention

When it happens

Trigger: Running `cloudflared tunnel delete <id>` (or `delete` accepting multiple IDs) where the tunnel-store GET for one of the IDs fails: nonexistent/typo'd tunnel ID, expired or missing origin cert credentials, unreachable api.cloudflare.com / custom api-url, or 4xx/5xx from the API.

Common situations: Deleting a tunnel that was already removed from the dashboard or by another operator; running the command from a machine without a valid ~/.cloudflared/cert.pem; corporate proxy or DNS failure blocking the API; pointing --api-url at the wrong endpoint.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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