{"record":{"id":"93228f6c8ef34880","repo":"cloudflare/cloudflared","slug":"cannot-parse-tag-value-s","errorCode":null,"errorMessage":"Cannot parse tag value %s","messagePattern":"Cannot parse tag value (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/tag.go","lineNumber":28,"sourceCode":"// Restrict key names to characters allowed in an HTTP header name.\n// Restrict key values to printable characters (what is recognised as data in an HTTP header value).\nvar tagRegexp = regexp.MustCompile(\"^([a-zA-Z0-9!#$%&'*+\\\\-.^_`|~]+)=([[:print:]]+)$\")\n\nfunc NewTagFromCLI(compoundTag string) (pogs.Tag, bool) {\n\tmatches := tagRegexp.FindStringSubmatch(compoundTag)\n\tif len(matches) == 0 {\n\t\treturn pogs.Tag{}, false\n\t}\n\treturn pogs.Tag{Name: matches[1], Value: matches[2]}, true\n}\n\nfunc NewTagSliceFromCLI(tags []string) ([]pogs.Tag, error) {\n\tvar tagSlice []pogs.Tag\n\tfor _, compoundTag := range tags {\n\t\tif tag, ok := NewTagFromCLI(compoundTag); ok {\n\t\t\ttagSlice = append(tagSlice, tag)\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"Cannot parse tag value %s\", compoundTag)\n\t\t}\n\t}\n\treturn tagSlice, nil\n}\n","sourceCodeStart":10,"sourceCodeEnd":33,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/tag.go#L10-L33","documentation":"NewTagSliceFromCLI converts --tag key=value CLI flags into pogs.Tag values. NewTagFromCLI returns ok=false for any entry that isn't a single key=value pair (e.g. missing '=', or multiple '=' segments producing wrong shape), so the whole tag slice fails with this parse error.","triggerScenarios":"Passing a malformed --tag flag value: no '=' separator (e.g. --tag foo), an empty string, or a value shape NewTagFromCLI rejects; also triggered programmatically via prepareTunnelConfig from any config file with an invalid tag entry.","commonSituations":"See trigger scenarios.","solutions":["Use the exact key=value form: --tag team=backend (repeat the flag for each tag).","Quote values containing spaces: --tag \"env=prod us-east\".","Check the config file's tag array entries for missing or extra '=' separators."],"exampleFix":"// before\ncloudflared tunnel run --tag team backend\n// after\ncloudflared tunnel run --tag team=backend","handlingStrategy":"validation","validationCode":"for _, t := range tagFlags {\n    parts := strings.SplitN(t, \"=\", 2)\n    if len(parts) != 2 || parts[0] == \"\" || parts[1] == \"\" {\n        return fmt.Errorf(\"tag %q must be key=value\", t)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write tags as --tag key=value with a single '='.","Quote values containing spaces.","Validate tag entries in config files before launching cloudflared."],"tags":["cli","validation","config","tags"],"backgroundTag":"invalid-argument-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"}