chenhg5/cc-connect · error
--session requires a value
Error message
--session requires a value
What it means
In parseSendArgs, the --session/-s flag must be followed by a session key. If the flag is the last token in argv, the parser cannot read a value and returns this error instead of leaving SessionKey empty.
Source
Thrown at cmd/cc-connect/send.go:91
var dataDir string
var useStdin bool
var imagePaths []string
var filePaths []string
var audioPaths []string
var videoPaths []string
var positional []string
for i := 0; i < len(args); i++ {
switch args[i] {
case "--project", "-p":
if i+1 >= len(args) {
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])View on GitHub (pinned to 4000b2338a)
Solutions
- Pass a session key: `cc-connect send --session <key> ...`.
- In scripts, validate the variable is non-empty before invoking, or drop the flag when unset.
- Use the documented env fallback for session if available rather than a bare flag.
Example fix
// before (SESSION empty in shell)
cc-connect send -s -m "hi"
// after
[ -n "$SESSION" ] && args=(-s "$SESSION") || args=(); cc-connect send "${args[@]}" -m "hi" Defensive patterns
Strategy: validation
Validate before calling
# shell
[ -n "$SESSION" ] || { echo "--session requires a value"; exit 2; }
cc-connect send -s "$SESSION" -m "hi" Try / catch
req, _, err := parseSendArgs(args)
if err != nil {
fmt.Fprintf(os.Stderr, "flag error: %v\n", err)
os.Exit(2)
} Prevention
- Quote session keys; use "${VAR:?}" guards in scripts.
- Omit the flag entirely when no session is intended.
- Keep a fixed argument order in automation to avoid truncation.
When it happens
Trigger: Running `cc-connect send --session` or `-s` as the final argument with no session key following it.
Common situations: Session key pulled from a variable that is empty (e.g. `$SESSION` unset so the shell expands to nothing); truncated command in automation.
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
- --message requires a value
- %s 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/4a132528914cbb44.
Report an issue: GitHub.