chenhg5/cc-connect · error

--at-users requires a value

Error message

--at-users requires a value

What it means

The --at-users flag of `cc-connect send` expects a comma-separated list of user IDs as its value. parseSendArgs returns "--at-users requires a value" when the flag has no following argument. The value is later split on commas and trimmed into the request's AtUsers list.

Source

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

			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":
			if i+1 >= len(args) {
				return req, "", fmt.Errorf("--at-users requires a value")
			}
			i++
			for _, uid := range strings.Split(args[i], ",") {
				uid = strings.TrimSpace(uid)
				if uid != "" {
					req.AtUsers = append(req.AtUsers, uid)
				}
			}
		case "--at-all":
			req.AtAll = true
		case "--data-dir":
			if i+1 >= len(args) {
				return req, "", fmt.Errorf("--data-dir requires a value")
			}
			i++
			dataDir = args[i]
		case "--help", "-h":
			return req, "", errSendUsage

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Pass a comma-separated list: `--at-users uid1,uid2`.
  2. Quote the list if it contains spaces.
  3. If you want to mention everyone, use the boolean `--at-all` instead of a bare --at-users.
  4. Check that the env/variable holding the IDs is non-empty.

Example fix

// before
cc-connect send --at-users --message "hi"
// after
cc-connect send --at-users ou_123,ou_456 --message "hi"
Defensive patterns

Strategy: validation

Validate before calling

USERS="uid1,uid2"
[ -n "$USERS" ] || { echo "at-users list empty"; exit 1; }
cc-connect send --at-users "$USERS" --message hi

Prevention

When it happens

Trigger: `cc-connect send --at-users` with no list; `cc-connect send --at-users --at-all`; empty variable expansion leaving only the flag.

Common situations: User IDs stored in a config/env that is unset; passing IDs on separate lines without quoting; assuming --at-users is boolean like --at-all.

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


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