chenhg5/cc-connect · error
--file requires a path
Error message
--file requires a path
What it means
The --file flag of `cc-connect send` requires a path argument. parseSendArgs returns "--file requires a path" when the flag is last or immediately followed by another flag. It is validated before the file is read or uploaded.
Source
Thrown at cmd/cc-connect/send.go:121
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")
}
i++
videoPaths = append(videoPaths, args[i])
case "--stdin":
useStdin = true
case "--at-users":View on GitHub (pinned to 4000b2338a)
Solutions
- Provide the path: `--file ./report.pdf`.
- Quote paths with spaces: `--file "my report.pdf"`.
- Verify the variable/glob expands to exactly one path per --file occurrence.
- Use `cc-connect send --help` to review attachment flags.
Example fix
// before cc-connect send --file // after cc-connect send --file ./docs/report.pdf
Defensive patterns
Strategy: validation
Validate before calling
F=./report.pdf
[ -n "$F" ] && [ -f "$F" ] || { echo "file missing or empty var"; exit 1; }
cc-connect send --file "$F" Prevention
- Place the path immediately after --file.
- Quote paths with spaces.
- Check glob/variable expansion produced exactly one path.
- Confirm the file exists before sending.
When it happens
Trigger: `cc-connect send --file` with nothing after it; `cc-connect send --file --at-users u1`; unquoted glob that fails to expand leaving the flag bare.
Common situations: Document path variable empty in CI, glob that matched nothing, truncation when the command is assembled from a template.
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
- --image 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/6ae4f9951387d645.
Report an issue: GitHub.