chenhg5/cc-connect · error
%s requires a value
Error message
%s requires a value
What it means
parseSendArgs handles --cwd/--work-dir (and similarly --tts) with a shared check: when the flag is the last token, the flag name itself is interpolated into `%s requires a value`. The error reports whichever option was left without its argument.
Source
Thrown at cmd/cc-connect/send.go:103
return req, "", fmt.Errorf("--project requires a value")
}
i++
req.Project = args[i]
case "--session", "-s":
if i+1 >= len(args) {
return req, "", fmt.Errorf("--session requires a value")
}
i++
req.SessionKey = args[i]
case "--message", "-m":
if i+1 >= len(args) {
return req, "", fmt.Errorf("--message requires a value")
}
i++
req.Message = args[i]
case "--cwd", "--work-dir":
if i+1 >= len(args) {
return req, "", fmt.Errorf("%s requires a value", args[i])
}
i++
req.WorkDir = args[i]
case "--tts":
if i+1 >= len(args) {
return req, "", fmt.Errorf("%s requires a value", args[i])
}
i++
req.TTSText = args[i]
case "--image":
if i+1 >= len(args) {
return req, "", fmt.Errorf("--image requires a path")
}
i++
imagePaths = append(imagePaths, args[i])
case "--file":
if i+1 >= len(args) {
return req, "", fmt.Errorf("--file requires a path")View on GitHub (pinned to 4000b2338a)
Solutions
- Append the path: `cc-connect send --cwd /path/to/workdir ...`.
- Guard the variable in scripts: use "${WORKDIR:?}" so empty values abort early.
- Verify argument order — the value must directly follow the flag.
Example fix
// before cc-connect send --cwd -m "hi" // after cc-connect send --cwd /srv/myproject -m "hi"
Defensive patterns
Strategy: validation
Validate before calling
# shell
[ -n "$WORKDIR" ] || { echo "--cwd requires a value"; exit 2; }
cc-connect send --cwd "$WORKDIR" -m "hi" Try / catch
req, _, err := parseSendArgs(args)
if err != nil {
fmt.Fprintf(os.Stderr, "flag error: %v\n", err)
os.Exit(2)
} Prevention
- Pass the path immediately after the flag: --cwd <path>.
- Guard path variables with ${WORKDIR:?} in scripts.
- Never place the next flag where a value is expected.
When it happens
Trigger: Running `cc-connect send --cwd` / `--work-dir` (or --tts) as the last argument so no path/value token follows; the message then reads e.g. `--cwd requires a value`.
Common situations: Workdir from an empty variable in CI scripts; user forgets the path; flag ordering mistakes where the value is placed before the flag.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- --project requires a value
- --session requires a value
- --message requires a value
- claudeSession: start: %w
- copilot: %q CLI not found in PATH, please install it first
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/c8e972e43de18d72.
Report an issue: GitHub.