{"record":{"id":"58933a54a8d9bb89","repo":"cloudflare/cloudflared","slug":"errinvalidtunnelid","errorCode":"ErrInvalidTunnelID","errorMessage":"unable to parse provided tunnel id as a valid UUID","messagePattern":"unable to parse provided tunnel id as a valid UUID","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/cliutil/management.go","lineNumber":23,"sourceCode":"\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/google/uuid\"\n\t\"github.com/mattn/go-colorable\"\n\t\"github.com/rs/zerolog\"\n\t\"github.com/urfave/cli/v2\"\n\n\t\"github.com/cloudflare/cloudflared/cfapi\"\n\tcfdflags \"github.com/cloudflare/cloudflared/cmd/cloudflared/flags\"\n\t\"github.com/cloudflare/cloudflared/credentials\"\n)\n\n// Error definitions for management token operations\nvar (\n\tErrNoTunnelID      = errors.New(\"no tunnel ID provided\")\n\tErrInvalidTunnelID = errors.New(\"unable to parse provided tunnel id as a valid UUID\")\n)\n\n// GetManagementToken acquires a management token from Cloudflare API for the specified resource\nfunc GetManagementToken(c *cli.Context, log *zerolog.Logger, res cfapi.ManagementResource, buildInfo *BuildInfo) (string, error) {\n\tuserCreds, err := credentials.Read(c.String(cfdflags.OriginCert), log)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar apiURL string\n\tif userCreds.IsFEDEndpoint() {\n\t\tapiURL = credentials.FedRampBaseApiURL\n\t} else {\n\t\tapiURL = c.String(cfdflags.ApiURL)\n\t}\n\n\tclient, err := userCreds.Client(apiURL, buildInfo.UserAgent(), log)\n\tif err != nil {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/cliutil/management.go#L5-L41","documentation":"GetManagementToken parses the supplied tunnel ID with github.com/google/uuid. If the argument is present but not a valid RFC-4122 UUID string, the parse error is wrapped with the sentinel ErrInvalidTunnelID so callers can errors.Is() it. This catches typos and wrong identifiers before hitting the Cloudflare API.","triggerScenarios":"`cloudflared tunnel info my-tunnel-name` (name instead of UUID), a truncated or mistyped UUID, or passing the connection/hostname ID where the tunnel UUID is expected.","commonSituations":"Users passing the human-readable tunnel name from the dashboard instead of its UUID; copying a partial ID from logs; shell truncation of the argument.","solutions":["Run `cloudflared tunnel list` and copy the full UUID (8-4-4-4-12 hex with dashes).","Use `cloudflared tunnel info <uuid>` with the exact UUID, not the tunnel name.","If scripting, validate the format first: UUID regex `^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`."],"exampleFix":"// before\nif !uuid.IsValid(tunnelID) { ... } // no pre-check, cloudflared fails\ncloudflared tunnel info \"my-tunnel\"\n// after\ncloudflared tunnel list | grep my-tunnel   # get UUID e.g. 6ff42ae2-765d-4adf-8112-... \ncloudflared tunnel info 6ff42ae2-765d-4adf-8112-5f4c8c564c11","handlingStrategy":"validation","validationCode":"import \"github.com/google/uuid\"\nfunc isUUID(s string) bool { _, err := uuid.Parse(s); return err == nil }","typeGuard":null,"tryCatchPattern":"if _, err := cliutil.GetManagementToken(c, log, res, buildInfo); err != nil {\n    if errors.Is(err, cliutil.ErrInvalidTunnelID) {\n        return fmt.Errorf(\"pass the tunnel UUID from `cloudflared tunnel list`, not its name\")\n    }\n    return err\n}","preventionTips":["Keep a mapping of tunnel name -> UUID in your infra repo.","Copy the full UUID including dashes from `cloudflared tunnel list`.","Regex-check IDs in CI scripts: ^[0-9a-f]{8}-[0-9a-f]{4}-...$ before invoking."],"tags":["cli","uuid","validation","tunnel"],"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-14T00:17:10.932Z"}