{"record":{"id":"88c547195395dd64","repo":"benbjohnson/litestream","slug":"too-many-arguments","errorCode":null,"errorMessage":"too many arguments","messagePattern":"too many arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/databases.go","lineNumber":24,"sourceCode":"\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"text/tabwriter\"\n)\n\n// DatabasesCommand is a command for listing managed databases.\ntype DatabasesCommand struct{}\n\n// Run executes the command.\nfunc (c *DatabasesCommand) Run(_ context.Context, args []string) (err error) {\n\tfs := flag.NewFlagSet(\"litestream-databases\", flag.ContinueOnError)\n\tconfigPath, noExpandEnv := registerConfigFlag(fs)\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} else if fs.NArg() != 0 {\n\t\treturn fmt.Errorf(\"too many arguments\")\n\t}\n\n\t// Load configuration.\n\tif *configPath == \"\" {\n\t\t*configPath = DefaultConfigPath()\n\t}\n\tconfig, err := ReadConfigFile(*configPath, !*noExpandEnv)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdatabases := make([]DatabaseInfo, 0, len(config.DBs))\n\tfor _, dbConfig := range config.DBs {\n\t\tdb, err := NewDBFromConfig(dbConfig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/databases.go#L6-L42","documentation":"CLI argument-count error from the `litestream databases` subcommand: positional arguments were supplied but the command accepts none — it reads databases from a config file (or default path) and lists them. Returned by `Run` immediately when `fs.NArg() != 0` after flag parsing.","triggerScenarios":"Running `litestream databases /etc/litestream.yml` passing the config path positionally instead of via `--config`; old muscle memory from other CLIs; shell scripts appending stray arguments.","commonSituations":"Users expecting `databases <db-path>` to filter to one database; migration from `litestream db` style commands; quoting errors leaving an empty string argument.","solutions":["Use `litestream databases --config /etc/litestream.yml` instead of a positional path","Run `litestream databases` with no positional args to list all configured DBs","Remove stray/empty positional arguments from the command line","Check `litestream databases --help` for accepted flags"],"exampleFix":"// before\nlitestream databases /etc/litestream.yml\n// after\nlitestream databases --config /etc/litestream.yml","handlingStrategy":"validation","validationCode":"// shell pre-check\nEXTRA=$((${#@} - $(printf '%s\\n' \"$@\" | grep -c '^--' || true)))\n# or simply: call with no positional args\nlitestream databases --config \"$CONFIG\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass positional args to litestream databases","Pass config via --config flag only","Add smoke tests for command syntax in CI"],"tags":["cli","arguments","litestream"],"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-14T00:17:10.932Z"}