{"record":{"id":"5430ac1adaf47416","repo":"cloudflare/cloudflared","slug":"can-t-get-tunnel-information-please-check-tunnel","errorCode":null,"errorMessage":"Can't get tunnel information. Please check tunnel id: %s","messagePattern":"Can't get tunnel information\\. Please check tunnel id: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/subcommand_context.go","lineNumber":222,"sourceCode":"\tclient, err := sc.client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.ListTunnels(filter)\n}\n\nfunc (sc *subcommandContext) delete(tunnelIDs []uuid.UUID) error {\n\tforceFlagSet := sc.c.Bool(cfdflags.Force)\n\n\tclient, err := sc.client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, id := range tunnelIDs {\n\t\ttunnel, err := client.GetTunnel(id)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"Can't get tunnel information. Please check tunnel id: %s\", id)\n\t\t}\n\n\t\t// Check if tunnel DeletedAt field has already been set\n\t\tif !tunnel.DeletedAt.IsZero() {\n\t\t\treturn fmt.Errorf(\"Tunnel %s has already been deleted\", tunnel.ID)\n\t\t}\n\n\t\tif err := client.DeleteTunnel(tunnel.ID, forceFlagSet); err != nil {\n\t\t\treturn errors.Wrapf(err, \"Error deleting tunnel %s\", tunnel.ID)\n\t\t}\n\n\t\tcredFinder := sc.credentialFinder(id)\n\t\tif tunnelCredentialsPath, err := credFinder.Path(); err == nil {\n\t\t\tif err = os.Remove(tunnelCredentialsPath); err != nil {\n\t\t\t\tsc.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)\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/subcommand_context.go#L204-L240","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the tunnel exists: `cloudflared tunnel list` and confirm the exact ID","Run `cloudflared tunnel info <id>` to test API connectivity/auth for that ID","Check that a valid origin certificate exists (`cloudflared tunnel login`) or pass --origincert","Check network/proxy reachability to the API (or --api-url value) and retry","If the tunnel is actually gone, remove the stale credentials file manually and skip deleting that ID"],"exampleFix":"// before (fails on one bad ID among many)\nfor _, id := range tunnelIDs {\n    tunnel, err := client.GetTunnel(id)\n    if err != nil {\n        return errors.Wrapf(err, \"Can't get tunnel information. Please check tunnel id: %s\", id)\n    }\n    ...\n}\n// after (log and continue with remaining IDs)\nfor _, id := range tunnelIDs {\n    tunnel, err := client.GetTunnel(id)\n    if err != nil {\n        sc.log.Error().Err(err).Str(\"tunnelID\", id.String()).Msg(\"Can't get tunnel information, skipping\")\n        continue\n    }\n    ...\n}","handlingStrategy":"try-catch","validationCode":"out, err := exec.Command(\"cloudflared\", \"tunnel\", \"list\").Output()\nif err != nil { /* API/auth problem — fix before delete */ }\nexists := strings.Contains(string(out), tunnelID)\nif !exists { return fmt.Errorf(\"tunnel %s not found\", tunnelID) }","typeGuard":"func tunnelIDLooksValid(id string) bool {\n    _, err := uuid.Parse(id)\n    return err == nil\n}","tryCatchPattern":"if err := run(\"cloudflared\", \"tunnel\", \"delete\", id); err != nil {\n    if strings.Contains(err.Error(), \"Can't get tunnel information\") {\n        // treat as not-found or auth issue; check `tunnel list` and cert\n    }\n}","preventionTips":["Always `cloudflared tunnel list` to confirm the ID before deleting","Keep a valid cert.pem via `cloudflared tunnel login` on every machine that runs delete","Check Cloudflare API status/proxy reachability when deletes fail in bulk","Fetch IDs programmatically instead of hand-copying"],"tags":["go","cli","cloudflare-tunnel","api-client"],"backgroundTag":"http-error-response","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}