cloudflare/cloudflared · error

no input provided

Error message

no input provided

What it means

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.

Solutions

  1. Pass the target hostname or URL as an argument, e.g. `cloudflared access ssh myapp.example.com`.
  2. In scripts, guard before invoking: `[ -n "$TARGET" ] || { echo 'target required'; exit 1; }`.
  3. Check quoting so the argument is not accidentally consumed or emptied by the shell.

Example fix

# before
cloudflared access ssh $TARGET   # TARGET unset
# after
: "${TARGET:?target host is required}"
cloudflared access ssh "$TARGET"
Defensive patterns

Strategy: validation

Validate before calling

func requireTarget(args []string) (string, error) {
    if len(args) == 0 || strings.TrimSpace(args[0]) == "" {
        return "", errors.New("target hostname is required")
    }
    return strings.TrimSpace(args[0]), nil
}

Try / catch

url, err := parseURL(input)
if err != nil {
    if err.Error() == "no input provided" {
        return fmt.Errorf("usage: cloudflared access <cmd> <hostname>")
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: Scripts where the target host variable is unset; wrappers that forward empty args; typos that drop the positional argument entirely.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06). Data as JSON: /api/errors/431f026461336572. Report an issue: GitHub.

Appendix: source

Thrown at cmd/cloudflared/access/validation.go:50

func bracketBareIPv6(input string) string {
	prefix := input[:strings.Index(input, "://")+3]
	rest := input[len(prefix):]
	host := rest
	if i := strings.IndexAny(rest, "/?#"); i >= 0 {
		host = rest[:i]
	}
	if net.ParseIP(host) != nil && strings.Contains(host, ":") {
		return prefix + "[" + host + "]" + rest[len(host):]
	}
	return input
}

// parseHostname will attempt to convert a user provided URL string into a string with some light error checking on
// certain expectations from the URL.
// Will convert all HTTP URLs to HTTPS
func parseURL(input string) (*url.URL, error) {
	if input == "" {
		return nil, errors.New("no input provided")
	}
	if !strings.HasPrefix(input, "https://") && !strings.HasPrefix(input, "http://") {
		input = fmt.Sprintf("https://%s", input)
	}
	input = bracketBareIPv6(input)
	url, err := url.ParseRequestURI(input)
	if err != nil {
		return nil, fmt.Errorf("failed to parse as URL: %w", err)
	}
	if url.Scheme != "https" {
		url.Scheme = "https"
	}
	if url.Host == "" {
		return nil, errors.New("failed to parse Host")
	}
	host, err := httpguts.PunycodeHostPort(url.Host)
	if err != nil || host == "" {
		return nil, err

View on GitHub (pinned to 2253eeeb25)