{"record":{"id":"008c83307ed126b2","repo":"tailscale/tailscale","slug":"expected-at-least-one-argument-after-method","errorCode":null,"errorMessage":"expected at least one argument after method","messagePattern":"expected at least one argument after method","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/tailscale/cli/debug.go","lineNumber":550,"sourceCode":"\t\t}\n\t}\n\treturn true\n}\n\nvar localAPIFlags struct {\n\tverbose bool\n}\n\nfunc runLocalAPI(ctx context.Context, args []string) error {\n\tif len(args) == 0 {\n\t\treturn errors.New(\"expected at least one argument\")\n\t}\n\tmethod := \"GET\"\n\tif looksLikeHTTPMethod(args[0]) {\n\t\tmethod = args[0]\n\t\targs = args[1:]\n\t\tif len(args) == 0 {\n\t\t\treturn errors.New(\"expected at least one argument after method\")\n\t\t}\n\t}\n\tpath := args[0]\n\tif !strings.HasPrefix(path, \"/localapi/\") {\n\t\tif !strings.Contains(path, \"/\") {\n\t\t\tpath = \"/localapi/v0/\" + path\n\t\t} else {\n\t\t\tpath = \"/localapi/\" + path\n\t\t}\n\t}\n\n\tvar body io.Reader\n\tif len(args) > 1 {\n\t\tif args[1] == \"-\" {\n\t\t\tfmt.Fprintf(Stderr, \"# reading request body from stdin...\\n\")\n\t\t\tall, err := io.ReadAll(os.Stdin)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"reading Stdin: %q\", err)","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/tailscale/tailscale/blob/cfe32b8be6a33f8e24fbc369cbfbf7c729d9e042/cmd/tailscale/cli/debug.go#L532-L568","documentation":"After runLocalAPI (debug.go:550) consumes an optional leading HTTP method token (GET/POST/PUT/DELETE/PATCH recognized by looksLikeHTTPMethod), it requires at least one more argument for the path. This error means the method was the only argument supplied.","triggerScenarios":"'tailscale debug local-api POST' with no endpoint; a script that interpolates \"$METHOD $PATH\" where PATH is empty.","commonSituations":"Dynamic construction of the request line where the path variable is empty or was consumed by earlier argument parsing.","solutions":["Append a path after the method: tailscale debug local-api POST /localapi/v0/dev-set-state","Check the variable holding the path is non-empty before invoking"],"exampleFix":"# before\ntailscale debug local-api POST\n# after\ntailscale debug local-api POST /localapi/v0/dev-set-state","handlingStrategy":"validation","validationCode":"# shell: when a method is given, a path must follow\nif printf '%s' \"$1\" | grep -qxE 'GET|POST|PUT|DELETE|PATCH'; then\n  : \"${2:?need a path after the HTTP method}\"\nfi\ntailscale debug local-api \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build the argument array as (\"$method\" \"$path\") and check path is non-empty before invoking","Prefer the path-only form; GET is the default method"],"tags":["tailscale","cli","debug","localapi","argument-validation"],"backgroundTag":null,"analyzedSha":"cfe32b8be6a33f8e24fbc369cbfbf7c729d9e042","analyzedAt":"2026-08-15T19:58:31.583Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}