{"record":{"id":"ad893acce59a31df","repo":"benbjohnson/litestream","slug":"too-many-arguments-ad893a","errorCode":null,"errorMessage":"too many arguments","messagePattern":"too many arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/stop.go","lineNumber":38,"sourceCode":"// Run executes the stop command.\nfunc (c *StopCommand) Run(ctx context.Context, args []string) error {\n\tfs := flag.NewFlagSet(\"litestream-stop\", flag.ContinueOnError)\n\ttimeout := fs.Int(\"timeout\", 30, \"timeout in seconds\")\n\tsocketPath := fs.String(\"socket\", \"/var/run/litestream.sock\", \"control socket path\")\n\tjsonOutput := fs.Bool(\"json\", false, \"output raw JSON\")\n\tfs.Usage = c.Usage\n\tif err := fs.Parse(args); err != nil {\n\t\treturn err\n\t}\n\n\tif fs.NArg() == 0 {\n\t\treturn &usageError{\n\t\t\tmessage: \"database path required\",\n\t\t\thint:    \"litestream stop /path/to/db\",\n\t\t}\n\t}\n\tif fs.NArg() > 1 {\n\t\treturn fmt.Errorf(\"too many arguments\")\n\t}\n\n\tdbPath := fs.Arg(0)\n\n\t// Create HTTP client that connects via Unix socket with timeout\n\tclientTimeout := time.Duration(*timeout) * time.Second\n\tclient := &http.Client{\n\t\tTimeout: clientTimeout,\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(_ context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\treturn net.DialTimeout(\"unix\", *socketPath, clientTimeout)\n\t\t\t},\n\t\t},\n\t}\n\n\treq := litestream.StopRequest{\n\t\tPath:    dbPath,\n\t\tTimeout: *timeout,","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/stop.go#L20-L56","documentation":"`litestream stop` accepts exactly one positional argument — the database path — after flag parsing. Supplying more than one triggers this plain 'too many arguments' error from the CLI argument validation in StopCommand.Run.","triggerScenarios":"Running e.g. `litestream stop /db1 /db2` or `litestream stop db1 db2` — any invocation where flagset NArg() exceeds 1.","commonSituations":"Users assuming stop takes multiple databases or glob patterns like `litestream stop /data/*.db`; scripts passing extra positional params; forgetting that flags must come before the DB path.","solutions":["Pass exactly one database path: litestream stop /path/to/db","Stop multiple databases by running the command once per DB","Quote the path so spaces don't split it into two arguments","Run `litestream stop -h` to review usage"],"exampleFix":"// before\nlitestream stop /data/app.db /data/analytics.db\n// after\nlitestream stop /data/app.db\nlitestream stop /data/analytics.db","handlingStrategy":"validation","validationCode":"args_count=$(nth_arg_count \"$@\")  # ensure exactly one positional after flags\n[ $# -gt 0 ] && [ \"$#\" -le 1 ] || { echo 'usage: litestream stop DB_PATH'; exit 64; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly one absolute DB path","Quote paths with spaces","Loop over databases in scripts instead of passing multiple args","Check `litestream stop -h` in scripts before adding args"],"tags":["cli","arguments"],"backgroundTag":"invalid-cli-argument","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}