cloudflare/cloudflared · error
incorrect args
Error message
incorrect args
What it means
The access curl command requires at least one argument (the target URL plus optional curl-style flags); with none provided it logs an explanatory message and returns this error. It is pure argument-count validation performed before any network activity.
Source
Thrown at cmd/cloudflared/access/cmd.go:308
return nil
}
// curl provides a wrapper around curl, passing Access JWT along in request
func curl(c *cli.Context) error {
err := sentry.Init(sentry.ClientOptions{
Dsn: sentryDSN,
Release: c.App.Version,
})
if err != nil {
return err
}
log := logger.CreateLoggerFromContext(c, logger.EnableTerminalLog)
args := c.Args()
if args.Len() < 1 {
log.Error().Msg("Please provide the access app and command you wish to run.")
return errors.New("incorrect args")
}
cmdArgs, allowRequest := parseAllowRequest(args.Slice())
appURL, err := getAppURL(cmdArgs, log)
if err != nil {
return err
}
appInfo, err := token.GetAppInfo(appURL)
if err != nil {
return err
}
// Verify that the existing token is still good; if not fetch a new one
if err := verifyTokenAtEdge(appURL, appInfo, c, log); err != nil {
log.Err(err).Msg("Could not verify token")
return err
}View on GitHub (pinned to 2253eeeb25)
Solutions
- Pass the target URL as the first argument: `cloudflared access curl https://app.example.com`
- Quote shell variables so empty values are not silently dropped: "$URL" vs $URL (and validate it is set first)
- Check the wrapper/script actually forwards arguments ("$@") to cloudflared
Example fix
// before # script.sh: cloudflared access curl $URL // after # script.sh: if [ -z "$URL" ]; then echo "URL required"; exit 1; fi # cloudflared access curl "$URL"
Defensive patterns
Strategy: validation
Validate before calling
if len(os.Args) < 3 { // program + subcommand + URL
return errors.New("usage: cloudflared access curl <url>")
} Try / catch
err := runAccessCurl(args)
if err != nil && strings.Contains(err.Error(), "incorrect args") {
return fmt.Errorf("access curl requires a URL argument: %w", err)
} Prevention
- Always quote and validate "$@"/"$URL" in wrapper scripts
- Check `cloudflared access curl --help` for argument order
- Add a usage check at the top of automation scripts
- Avoid invoking through wrappers that may drop arguments
When it happens
Trigger: Running `cloudflared access curl` with no arguments, e.g. forgetting the target URL or invoking the command from a wrapper that drops the arguments.
Common situations: Shell scripts with unquoted/empty variables ("$URL" expanding to nothing); misunderstanding that `access curl` needs the app URL as its first argument; copy-pasted commands missing the final argument.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- not a valid url
- empty application token
- not a valid host
- no input provided
- You must supply at least 2 arguments, first the network you
AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06).
Data as JSON: /api/errors/0929fb280857b4c1.
Report an issue: GitHub.