{"record":{"id":"0e8996f9bc422cdd","repo":"cloudflare/cloudflared","slug":"specified-origin-urls-using-both-url-and-argumen","errorCode":null,"errorMessage":"Specified origin urls using both --url and argument. Decide which one you want, I can only support one.","messagePattern":"Specified origin urls using both --url and argument\\. Decide which one you want, I can only support one\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/configuration.go","lineNumber":169,"sourceCode":"\treturn path\n}\n\n// ValidateUnixSocket ensures --unix-socket param is used exclusively\n// i.e. it fails if a user specifies both --url and --unix-socket\nfunc ValidateUnixSocket(c *cli.Context) (string, error) {\n\tif c.IsSet(\"unix-socket\") && (c.IsSet(\"url\") || c.NArg() > 0) {\n\t\treturn \"\", errors.New(\"--unix-socket must be used exclusively.\")\n\t}\n\treturn c.String(\"unix-socket\"), nil\n}\n\n// ValidateUrl will validate url flag correctness. It can be either from --url or argument\n// Notice ValidateUnixSocket, it will enforce --unix-socket is not used with --url or argument\nfunc ValidateUrl(c *cli.Context, allowURLFromArgs bool) (*url.URL, error) {\n\tvar url = c.String(\"url\")\n\tif allowURLFromArgs && c.NArg() > 0 {\n\t\tif c.IsSet(\"url\") {\n\t\t\treturn nil, errors.New(\"Specified origin urls using both --url and argument. Decide which one you want, I can only support one.\")\n\t\t}\n\t\turl = c.Args().Get(0)\n\t}\n\tvalidUrl, err := validation.ValidateUrl(url)\n\treturn validUrl, err\n}\n\ntype UnvalidatedIngressRule struct {\n\tHostname      string              `json:\"hostname,omitempty\"`\n\tPath          string              `json:\"path,omitempty\"`\n\tService       string              `json:\"service,omitempty\"`\n\tOriginRequest OriginRequestConfig `yaml:\"originRequest\" json:\"originRequest\"`\n}\n\n// OriginRequestConfig is a set of optional fields that users may set to\n// customize how cloudflared sends requests to origin services. It is used to set\n// up general config that apply to all rules, and also, specific per-rule\n// config.","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/config/configuration.go#L151-L187","documentation":"ValidateUrl checks the origin URL, which can come from the --url flag or from a positional argument. When both are present in a context that allows arguments (allowURLFromArgs, e.g. the ssh subcommand), the source is ambiguous, so the library refuses to pick one and returns this error.","triggerScenarios":"ValidateUrl is called with allowURLFromArgs=true and c.NArg() > 0 while c.IsSet(\"url\") is also true — e.g. `cloudflared access ssh --url http://localhost:8080 destination` or a merged config where both exist.","commonSituations":"Users passing the destination host as an argument while also supplying --url; tooling that injects --url automatically while the user also types a positional argument; config files merged with CLI flags.","solutions":["Remove the --url flag and keep only the positional argument, or drop the argument and keep --url","Check the cloudflared config file for a 'url:' entry that is being merged with the command-line argument","For ssh-style usage, pass only the destination as the argument and let --url default"],"exampleFix":"// before\ncloudflared access ssh --url http://localhost:8080 myhost.example.com\n// after\ncloudflared access ssh myhost.example.com","handlingStrategy":"validation","validationCode":"if allowURLFromArgs && c.NArg() > 0 && c.IsSet(\"url\") {\n    return errors.New(\"choose either --url or a positional argument for the origin\")\n}","typeGuard":"func originSourceIsAmbiguous(c *cli.Context, allowArgs bool) bool {\n    return allowArgs && c.NArg() > 0 && c.IsSet(\"url\")\n}","tryCatchPattern":null,"preventionTips":["Pick a single convention (flag vs argument) for origin URLs in your scripts","Check config-file 'url:' entries that merge with CLI arguments","Validate arguments before invoking cloudflared subcommands that accept positional URLs"],"tags":["cli","config","conflicting-flags"],"backgroundTag":"mutually-exclusive-flags","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"}