chenhg5/cc-connect · error
%s requires a value
Error message
%s requires a value
What it means
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.
Source
Thrown at cmd/cc-connect/tuitui.go:226
_, params, err := mime.ParseMediaType(contentDisposition)
if err == nil && params["filename"] != "" {
return params["filename"]
}
}
u, err := url.Parse(rawURL)
if err != nil {
return ""
}
return filepath.Base(u.Path)
}
func parseTuiTuiArgs(args []string) (tuituiCLIOptions, error) {
var opts tuituiCLIOptions
for i := 0; i < len(args); i++ {
arg := args[i]
value := func() (string, error) {
if i+1 >= len(args) {
return "", fmt.Errorf("%s requires a value", arg)
}
i++
return args[i], nil
}
switch arg {
case "--config":
v, err := value()
if err != nil {
return opts, err
}
opts.configPath = v
opts.configSet = true
case "--project", "-p":
v, err := value()
if err != nil {
return opts, err
}
opts.project = vView on GitHub (pinned to 4000b2338a)
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"
Example fix
// before $ cc-connect tuitui post --config // after $ cc-connect tuitui post --config ~/.config/cc-connect/config.toml
Defensive patterns
Strategy: validation
Validate before calling
for i, a := range args {
if requiresValue[a] && i == len(args)-1 {
return fmt.Errorf("%s requires a value", a)
}
} Try / catch
opts, err := parseTuiTuiArgs(args)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
} Prevention
- Always put the value immediately after the flag
- Quote values with spaces or empty shell variables
- Run with --help to see flags requiring values
When it happens
Trigger: Running e.g. `cc-connect tuitui post --config` with no value after the flag — i+1 >= len(args) inside the value() closure.
Common situations: Truncated shell commands; copy-paste dropping the value; shell variable expansion producing an empty string that the shell drops.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- unknown option: %s
- unknown flag: %s
- unknown top-level command: %s
- --image requires a path
- --file requires a path
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/2f83bd7c336f5eef.
Report an issue: GitHub.