{"record":{"id":"2f83bd7c336f5eef","repo":"chenhg5/cc-connect","slug":"s-requires-a-value-2f83bd","errorCode":null,"errorMessage":"%s requires a value","messagePattern":"(.+?) requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/tuitui.go","lineNumber":226,"sourceCode":"\t\t_, params, err := mime.ParseMediaType(contentDisposition)\n\t\tif err == nil && params[\"filename\"] != \"\" {\n\t\t\treturn params[\"filename\"]\n\t\t}\n\t}\n\tu, err := url.Parse(rawURL)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn filepath.Base(u.Path)\n}\n\nfunc parseTuiTuiArgs(args []string) (tuituiCLIOptions, error) {\n\tvar opts tuituiCLIOptions\n\tfor i := 0; i < len(args); i++ {\n\t\targ := args[i]\n\t\tvalue := func() (string, error) {\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn \"\", fmt.Errorf(\"%s requires a value\", arg)\n\t\t\t}\n\t\t\ti++\n\t\t\treturn args[i], nil\n\t\t}\n\t\tswitch arg {\n\t\tcase \"--config\":\n\t\t\tv, err := value()\n\t\t\tif err != nil {\n\t\t\t\treturn opts, err\n\t\t\t}\n\t\t\topts.configPath = v\n\t\t\topts.configSet = true\n\t\tcase \"--project\", \"-p\":\n\t\t\tv, err := value()\n\t\t\tif err != nil {\n\t\t\t\treturn opts, err\n\t\t\t}\n\t\t\topts.project = v","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/tuitui.go#L208-L244","documentation":"parseTuiTuiArgs validates CLI flags for the tuitui subcommand. When a flag that requires an argument (e.g. --config, --limit, --max-bytes, --project) appears as the last token with no following value, this error names the offending flag. It is a standard argc-check closure over the loop index i.","triggerScenarios":"Running e.g. `cc-connect tuitui post --config` with no value after the flag — i+1 >= len(args) inside the value() closure.","commonSituations":"Truncated shell commands; copy-paste dropping the value; shell variable expansion producing an empty string that the shell drops.","solutions":["Supply the value after the flag: --config /path/to/config.toml","Quote values containing spaces so the shell does not split them","Quote empty-valued shell variables: --project \"$PROJ\""],"exampleFix":"// before\n$ cc-connect tuitui post --config\n// after\n$ cc-connect tuitui post --config ~/.config/cc-connect/config.toml","handlingStrategy":"validation","validationCode":"for i, a := range args {\n\tif requiresValue[a] && i == len(args)-1 {\n\t\treturn fmt.Errorf(\"%s requires a value\", a)\n\t}\n}","typeGuard":null,"tryCatchPattern":"opts, err := parseTuiTuiArgs(args)\nif err != nil {\n\tfmt.Fprintln(os.Stderr, err)\n\tos.Exit(2)\n}","preventionTips":["Always put the value immediately after the flag","Quote values with spaces or empty shell variables","Run with --help to see flags requiring values"],"tags":["cli","argument-parsing","flag"],"backgroundTag":"missing-required-argument","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}