{"record":{"id":"adc304e4e5cc490c","repo":"cloudflare/cloudflared","slug":"s-is-not-a-valid-tunnel-id","errorCode":null,"errorMessage":"%s is not a valid tunnel ID","messagePattern":"(.+?) is not a valid tunnel ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/subcommands.go","lineNumber":366,"sourceCode":"\tif !c.Bool(\"show-deleted\") {\n\t\tfilter.NoDeleted()\n\t}\n\tif name := c.String(flags.Name); name != \"\" {\n\t\tfilter.ByName(name)\n\t}\n\tif namePrefix := c.String(\"name-prefix\"); namePrefix != \"\" {\n\t\tfilter.ByNamePrefix(namePrefix)\n\t}\n\tif excludePrefix := c.String(\"exclude-name-prefix\"); excludePrefix != \"\" {\n\t\tfilter.ExcludeNameWithPrefix(excludePrefix)\n\t}\n\tif existedAt := c.Timestamp(\"time\"); existedAt != nil {\n\t\tfilter.ByExistedAt(*existedAt)\n\t}\n\tif id := c.String(\"id\"); id != \"\" {\n\t\ttunnelID, err := uuid.Parse(id)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"%s is not a valid tunnel ID\", id)\n\t\t}\n\t\tfilter.ByTunnelID(tunnelID)\n\t}\n\tif maxFetch := c.Int(\"max-fetch-size\"); maxFetch > 0 {\n\t\tfilter.MaxFetchSize(uint(maxFetch))\n\t}\n\n\ttunnels, err := sc.list(filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sort the tunnels\n\tsortBy := c.String(\"sort-by\")\n\tinvalidSortField := false\n\tsort.Slice(tunnels, func(i, j int) bool {\n\t\tcmp := func() bool {\n\t\t\tswitch sortBy {","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/subcommands.go#L348-L384","documentation":"`cloudflared tunnel list --id <value>` parses the --id flag with uuid.Parse to filter the list to one tunnel. If the value is not a well-formed UUID (8-4-4-4-12 hex format), the parse error is wrapped as '<value> is not a valid tunnel ID'.","triggerScenarios":"Passing a tunnel NAME or a malformed string to the --id flag of `cloudflared tunnel list` instead of a UUID — e.g. --id my-tunnel or --id with stray whitespace/quotes.","commonSituations":"Copy-pasting the tunnel name instead of its UUID from `cloudflared tunnel list` output; extra shell quoting or trailing whitespace in scripts; truncated UUIDs from earlier command output.","solutions":["Get the exact UUID via `cloudflared tunnel list` and pass it to --id","Verify the ID is a valid UUID v4-like string (8-4-4-4-12 hex chars)","If you only know the name, run list without --id and filter by name instead","Trim whitespace/quotes around the value in shell scripts"],"exampleFix":"// before\ncloudflared tunnel list --id my-tunnel\n// after\ncloudflared tunnel list --id 7c5b3a20-1b2f-4a3e-9c8d-1234567890ab","handlingStrategy":"validation","validationCode":"func isValidUUID(s string) bool {\n\t_, err := uuid.Parse(strings.TrimSpace(s))\n\treturn err == nil\n}\n// before calling: cloudflared tunnel list --id <v>\nif !isValidUUID(flagValue) { /* fix input before invoking */ }","typeGuard":"func isTunnelUUID(v string) bool {\n\t_, err := uuid.Parse(strings.TrimSpace(v))\n\treturn err == nil\n}","tryCatchPattern":"tunnelID, err := uuid.Parse(id)\nif err != nil {\n\treturn fmt.Errorf(\"%s is not a valid tunnel ID: %w\", id, err)\n}","preventionTips":["Copy UUIDs from `cloudflared tunnel list --output json` to avoid transcription errors","Never pass tunnel names to flags that expect IDs","Trim whitespace/quotes from flag values in shell scripts","Store tunnel IDs in a single source (config file) rather than retyping"],"tags":["cloudflared","cli","uuid","validation"],"backgroundTag":"invalid-identifier-format","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"}