{"record":{"id":"a61164b6c00a6add","repo":"cloudflare/cloudflared","slug":"there-should-only-be-1-non-deleted-tunnel-named-s","errorCode":null,"errorMessage":"there should only be 1 non-deleted Tunnel named %s","messagePattern":"there should only be 1 non-deleted Tunnel named (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/subcommand_context.go","lineNumber":395,"sourceCode":"}\n\n// findIDs is just like mapping `findID` over a slice, but it only uses\n// one Tunnelstore API call per non-UUID input provided.\nfunc (sc *subcommandContext) findIDs(inputs []string) ([]uuid.UUID, error) {\n\tuuids, names := splitUuids(inputs)\n\n\tfor _, name := range names {\n\t\tfilter := cfapi.NewTunnelFilter()\n\t\tfilter.NoDeleted()\n\t\tfilter.ByName(name)\n\n\t\ttunnels, err := sc.list(filter)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif len(tunnels) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"there should only be 1 non-deleted Tunnel named %s\", name)\n\t\t}\n\n\t\tuuids = append(uuids, tunnels[0].ID)\n\t}\n\n\treturn uuids, nil\n}\n\nfunc splitUuids(inputs []string) ([]uuid.UUID, []string) {\n\tuuids := make([]uuid.UUID, 0)\n\tnames := make([]string, 0)\n\n\tfor _, input := range inputs {\n\t\tid, err := uuid.Parse(input)\n\t\tif err != nil {\n\t\t\tnames = append(names, input)\n\t\t} else {\n\t\t\tuuids = append(uuids, id)","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/subcommand_context.go#L377-L413","documentation":"findIDs resolves multiple tunnel names to UUIDs using a single Tunnelstore API call per non-UUID input. The API contract assumes a tunnel name maps to exactly one non-deleted tunnel; when the filtered list returns a count other than 1, cloudflared cannot disambiguate and raises this error.","triggerScenarios":"Calling commands that accept multiple tunnel names (e.g. `cloudflared tunnel delete <name1> <name2>` or cleanup) where a name matches zero or more than one non-deleted tunnel in the account.","commonSituations":"Duplicate tunnels created under the same name in different environments sharing one account; the name was already deleted (list returns 0); race where a duplicate tunnel was created concurrently.","solutions":["Run `cloudflared tunnel list` and resolve duplicates: delete or rename extra tunnels with the same name.","If zero results, check spelling and account (cert.pem must belong to the account owning the tunnel).","Use the tunnel's UUID directly instead of the name to avoid ambiguity."],"exampleFix":"// before\ncloudflared tunnel delete staging   // ambiguous or missing\n// after\ncloudflared tunnel list\ncloudflared tunnel delete <exact-tunnel-uuid>","handlingStrategy":"validation","validationCode":"out, _ := exec.Command(\"cloudflared\", \"tunnel\", \"list\", \"--output\", \"json\").Output()\nvar tunnels []struct{ Name string }\njson.Unmarshal(out, &tunnels)\ncount := 0\nfor _, t := range tunnels { if t.Name == name { count++ } }\nif count != 1 { return fmt.Errorf(\"expected exactly 1 tunnel named %s, found %d\", name, count) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep tunnel names unique in your account; delete or rename stale duplicates.","Use UUIDs when operating on multiple tunnels in one command.","Audit `cloudflared tunnel list` output in automation before batch operations."],"tags":["cli","not-found","ambiguity","tunnel"],"backgroundTag":"entity-not-found","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"}