chenhg5/cc-connect · error
--image requires a path
Error message
--image requires a path
What it means
The --image flag of `cc-connect send` requires exactly one path argument per occurrence. If --image is the last argument or is followed by another flag, parseSendArgs returns "--image requires a path". This is a usage error caught before any file I/O.
Source
Thrown at cmd/cc-connect/send.go:115
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")
}
i++
filePaths = append(filePaths, args[i])
case "--audio":
if i+1 >= len(args) {
return req, "", fmt.Errorf("--audio requires a path")
}
i++
audioPaths = append(audioPaths, args[i])
case "--video":
if i+1 >= len(args) {
return req, "", fmt.Errorf("--video requires a path")View on GitHub (pinned to 4000b2338a)
Solutions
- Append the image path right after the flag: `--image ./screenshot.png`.
- Quote paths containing spaces: `--image "my shot.png"`.
- Check that shell variables are non-empty before invocation.
- Repeat --image for each image; never bundle multiple paths in one value.
Example fix
// before cc-connect send --image // after cc-connect send --image ./screenshots/bug.png
Defensive patterns
Strategy: validation
Validate before calling
IMG=./shot.png
[ -n "$IMG" ] || { echo "image path empty"; exit 1; }
cc-connect send --image "$IMG" Try / catch
try { await $`cc-connect send --image ${img}`; }
catch (e) { if (String(e).includes('--image requires a path')) console.error('Supply a path after --image'); } Prevention
- Never leave --image as the last argument.
- Quote paths with spaces.
- Verify shell variables holding image paths are non-empty.
- One path per --image occurrence.
When it happens
Trigger: `cc-connect send --image` with no trailing path; `cc-connect send --image --message hi`; an empty variable expansion leaving `--image` dangling.
Common situations: Shell variable holding the path is unset/empty (`--image $IMG` with IMG=""), path with spaces unquoted so it splits into two args, copy-paste drops the filename.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- --file requires a path
- --audio requires a path
- --video requires a path
- unknown flag: %s
- unknown top-level command: %s
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/1db0478e7e910eb7.
Report an issue: GitHub.