{"record":{"id":"431f026461336572","repo":"cloudflare/cloudflared","slug":"no-input-provided","errorCode":null,"errorMessage":"no input provided","messagePattern":"no input provided","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/access/validation.go","lineNumber":50,"sourceCode":"func bracketBareIPv6(input string) string {\n\tprefix := input[:strings.Index(input, \"://\")+3]\n\trest := input[len(prefix):]\n\thost := rest\n\tif i := strings.IndexAny(rest, \"/?#\"); i >= 0 {\n\t\thost = rest[:i]\n\t}\n\tif net.ParseIP(host) != nil && strings.Contains(host, \":\") {\n\t\treturn prefix + \"[\" + host + \"]\" + rest[len(host):]\n\t}\n\treturn input\n}\n\n// parseHostname will attempt to convert a user provided URL string into a string with some light error checking on\n// certain expectations from the URL.\n// Will convert all HTTP URLs to HTTPS\nfunc parseURL(input string) (*url.URL, error) {\n\tif input == \"\" {\n\t\treturn nil, errors.New(\"no input provided\")\n\t}\n\tif !strings.HasPrefix(input, \"https://\") && !strings.HasPrefix(input, \"http://\") {\n\t\tinput = fmt.Sprintf(\"https://%s\", input)\n\t}\n\tinput = bracketBareIPv6(input)\n\turl, err := url.ParseRequestURI(input)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse as URL: %w\", err)\n\t}\n\tif url.Scheme != \"https\" {\n\t\turl.Scheme = \"https\"\n\t}\n\tif url.Host == \"\" {\n\t\treturn nil, errors.New(\"failed to parse Host\")\n\t}\n\thost, err := httpguts.PunycodeHostPort(url.Host)\n\tif err != nil || host == \"\" {\n\t\treturn nil, err","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/access/validation.go#L32-L68","documentation":"parseURL in cmd/cloudflared/access/validation.go converts a user-supplied hostname/URL into a *url.URL for Access subcommands (ssh, ssh-gen, curl-style helpers). It rejects empty input outright with this error before any parsing is attempted, because there is nothing to build an Access URL from.","triggerScenarios":"Calling `cloudflared access ssh`, `access ssh-gen`, or any command whose argument flows through getAppURLFromArgs/parseURL with an empty string — e.g. `cloudflared access ssh \"\"` or a shell variable like $HOST that is unset/empty.","commonSituations":"Scripts where the target host variable is unset; wrappers that forward empty args; typos that drop the positional argument entirely.","solutions":["Pass the target hostname or URL as an argument, e.g. `cloudflared access ssh myapp.example.com`.","In scripts, guard before invoking: `[ -n \"$TARGET\" ] || { echo 'target required'; exit 1; }`.","Check quoting so the argument is not accidentally consumed or emptied by the shell."],"exampleFix":"# before\ncloudflared access ssh $TARGET   # TARGET unset\n# after\n: \"${TARGET:?target host is required}\"\ncloudflared access ssh \"$TARGET\"","handlingStrategy":"validation","validationCode":"func requireTarget(args []string) (string, error) {\n    if len(args) == 0 || strings.TrimSpace(args[0]) == \"\" {\n        return \"\", errors.New(\"target hostname is required\")\n    }\n    return strings.TrimSpace(args[0]), nil\n}","typeGuard":null,"tryCatchPattern":"url, err := parseURL(input)\nif err != nil {\n    if err.Error() == \"no input provided\" {\n        return fmt.Errorf(\"usage: cloudflared access <cmd> <hostname>\")\n    }\n    return err\n}","preventionTips":["Use `: \"${VAR:?message}\"` shell guards for variables forwarded to cloudflared.","Echo the command with args before executing in scripts to catch empty arguments.","Wrap access commands in a function that validates the positional host argument first."],"tags":["cli","validation","url","access"],"backgroundTag":"missing-required-argument","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"}