{"record":{"id":"bbcbe455256e4871","repo":"iawia002/lux","slug":"too-few-arguments","errorCode":null,"errorMessage":"too few arguments","messagePattern":"too few arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/app.go","lineNumber":230,"sourceCode":"\t\t\targs := c.Args().Slice()\n\n\t\t\tif c.Bool(\"debug\") {\n\t\t\t\tcli.VersionPrinter(c)\n\t\t\t}\n\n\t\t\tif file := c.String(\"file\"); file != \"\" {\n\t\t\t\tf, err := os.Open(file)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdefer f.Close() // nolint\n\n\t\t\t\tfileItems := utils.ParseInputFile(f, c.String(\"items\"), int(c.Uint(\"start\")), int(c.Uint(\"end\")))\n\t\t\t\targs = append(args, fileItems...)\n\t\t\t}\n\n\t\t\tif len(args) < 1 {\n\t\t\t\treturn errors.New(\"too few arguments\")\n\t\t\t}\n\n\t\t\tcookie := c.String(\"cookie\")\n\t\t\tif cookie != \"\" {\n\t\t\t\t// If cookie is a file path, convert it to a string to ensure cookie is always string\n\t\t\t\tif _, fileErr := os.Stat(cookie); fileErr == nil {\n\t\t\t\t\t// Cookie is a file\n\t\t\t\t\tdata, err := os.ReadFile(cookie)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tcookie = strings.TrimSpace(string(data))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trequest.SetOptions(request.Options{\n\t\t\t\tRetryTimes: int(c.Uint(\"retry\")),\n\t\t\t\tCookie:     cookie,","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/iawia002/lux/blob/dd00f6d258d80b6684a0b9402d7124e5c18ef42f/app/app.go#L212-L248","documentation":"Usage error from the lux CLI entrypoint: after flags are parsed and the optional --items/--file input is read, the positional argument list is still empty, so there is no URL to download. The -i file is run through utils.ParseInputFile with --start/--end selecting a line window, and a window that selects no lines yields zero items. It is thrown before any network activity.","triggerScenarios":"Invoking the binary with only flags (e.g. lux -F mp4); passing an empty or whitespace-only items file; setting --start/--end outside the number of link lines in the items file so ParseInputFile returns no entries.","commonSituations":"Scripts or cron jobs that forget the positional URL; batch files with blank lines; 1-based vs 0-based confusion on --start/--end. A bad file path fails earlier at os.Open, but a valid file with no usable lines fails exactly here.","solutions":["Pass at least one video URL as a positional argument, e.g. lux \"https://www.bilibili.com/video/av170001\".","If using -i/--items, confirm the file contains non-empty link lines and that --start/--end fall inside that range.","When automating, echo the parsed item count before extracting so an empty batch fails loudly at the source."],"exampleFix":"// before\n$ lux -F mp4\n// after\n$ lux -F mp4 \"https://www.bilibili.com/video/av170001\"\n$ lux -F mp4 -i items.txt --start 1 --end 10","handlingStrategy":"validation","validationCode":"items := utils.ParseInputFile(f, c.String(\"items\"), int(c.Uint(\"start\")), int(c.Uint(\"end\")))\nif len(args)+len(items) == 0 {\n\treturn cli.Exit(\"too few arguments: pass a video URL or a non-empty --items file\", 1)\n}","typeGuard":null,"tryCatchPattern":"Not a recoverable runtime error — do not catch. Handle at the CLI layer: print the app usage (cli.ShowAppHelp) and exit non-zero. Retrying with the same argv cannot succeed.","preventionTips":["Always include one positional URL, or verify the --items file has non-empty link lines before running","Validate --start/--end against the line count of the batch file","In wrappers, check os.Args length before invoking the binary and fail with a clear message"],"tags":["cli","arguments","usage","batch"],"backgroundTag":null,"analyzedSha":"dd00f6d258d80b6684a0b9402d7124e5c18ef42f","analyzedAt":"2026-08-15T16:57:31.080Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}