chenhg5/cc-connect · error

--project requires a value

Error message

--project requires a value

What it means

parseSendArgs parses CLI arguments for `cc-connect send`. When --project (or -p) is passed as the last argument with nothing after it, there is no value to assign to req.Project, so it returns this error. It is a guard against truncated flag usage.

Source

Thrown at cmd/cc-connect/send.go:85

}

var errSendUsage = errors.New("show send usage")

func parseSendArgs(args []string) (core.SendRequest, string, error) {
	var req core.SendRequest
	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])

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Provide a value: `cc-connect send --project <project-name> ...`.
  2. If the value is optional in your script, omit the flag entirely instead of passing it bare.
  3. Check shell quoting/variable expansion so the value isn't lost before exec.

Example fix

// before
cc-connect send -p -m "hello"
// after
cc-connect send -p myproject -m "hello"
Defensive patterns

Strategy: validation

Validate before calling

# shell: verify flag has a value before invoking
[ -n "$PROJECT" ] || { echo "--project requires a value"; exit 2; }

Try / catch

req, _, err := parseSendArgs(os.Args[2:])
if err != nil {
    fmt.Fprintf(os.Stderr, "usage: cc-connect send [--project <name>] ...\n%v\n", err)
    os.Exit(2)
}

Prevention

When it happens

Trigger: Running `cc-connect send --project` or `cc-connect send -p` with no following token (flag at end of argv).

Common situations: Shell scripts building the command conditionally drop the project name; users forget the value; copy-paste truncates the command line.

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


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/5721ac2656fe9844. Report an issue: GitHub.