chenhg5/cc-connect · error

--message requires a value

Error message

--message requires a value

What it means

A sentinel from the send-command argument parser: the --message/-m flag appeared as the last argument with no following value. Strict per-flag arity validation rejects it before any message can be composed.

Source

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

	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])
			}
			i++
			req.TTSText = args[i]
		case "--image":
			if i+1 >= len(args) {
				return req, "", fmt.Errorf("--image requires a path")

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Supply the text: `cc-connect send -m "your message"`.
  2. Quote the message so spaces/newlines survive shell parsing.
  3. If sending only an attachment, omit -m entirely (attachment-only sends are allowed).

Example fix

// before (MSG empty)
cc-connect send -m $MSG
// after
cc-connect send -m "${MSG:?message is required}"
Defensive patterns

Strategy: validation

Validate before calling

# shell
[ -n "$MSG" ] || [ -n "$AUDIO" ] || { echo "--message requires a value (or provide an attachment)"; exit 2; }
cc-connect send -m "$MSG"

Try / catch

req, _, err := parseSendArgs(args)
if err != nil {
    fmt.Fprintf(os.Stderr, "flag error: %v\n", err)
    os.Exit(2)
}

Prevention

When it happens

Trigger: Running `cc-connect send --message` or `-m` with no following text token.

Common situations: Message built from an empty shell variable; quoting errors cause the text to be eaten; user omits the text after 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


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