{"record":{"id":"0929fb280857b4c1","repo":"cloudflare/cloudflared","slug":"incorrect-args","errorCode":null,"errorMessage":"incorrect args","messagePattern":"incorrect args","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/access/cmd.go","lineNumber":308,"sourceCode":"\n\treturn nil\n}\n\n// curl provides a wrapper around curl, passing Access JWT along in request\nfunc curl(c *cli.Context) error {\n\terr := sentry.Init(sentry.ClientOptions{\n\t\tDsn:     sentryDSN,\n\t\tRelease: c.App.Version,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog := logger.CreateLoggerFromContext(c, logger.EnableTerminalLog)\n\n\targs := c.Args()\n\tif args.Len() < 1 {\n\t\tlog.Error().Msg(\"Please provide the access app and command you wish to run.\")\n\t\treturn errors.New(\"incorrect args\")\n\t}\n\n\tcmdArgs, allowRequest := parseAllowRequest(args.Slice())\n\tappURL, err := getAppURL(cmdArgs, log)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappInfo, err := token.GetAppInfo(appURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Verify that the existing token is still good; if not fetch a new one\n\tif err := verifyTokenAtEdge(appURL, appInfo, c, log); err != nil {\n\t\tlog.Err(err).Msg(\"Could not verify token\")\n\t\treturn err\n\t}","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/access/cmd.go#L290-L326","documentation":"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.","triggerScenarios":"Running `cloudflared access curl` with no arguments, e.g. forgetting the target URL or invoking the command from a wrapper that drops the arguments.","commonSituations":"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.","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"],"exampleFix":"// before\n# script.sh: cloudflared access curl $URL\n// after\n# script.sh: if [ -z \"$URL\" ]; then echo \"URL required\"; exit 1; fi\n# cloudflared access curl \"$URL\"","handlingStrategy":"validation","validationCode":"if len(os.Args) < 3 { // program + subcommand + URL\n    return errors.New(\"usage: cloudflared access curl <url>\")\n}","typeGuard":null,"tryCatchPattern":"err := runAccessCurl(args)\nif err != nil && strings.Contains(err.Error(), \"incorrect args\") {\n    return fmt.Errorf(\"access curl requires a URL argument: %w\", err)\n}","preventionTips":["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"],"tags":["cli","arguments","access"],"backgroundTag":"missing-cli-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"}