chenhg5/cc-connect · error

--data-dir requires a value

Error message

--data-dir requires a value

What it means

The --data-dir flag of `cc-connect send` overrides the session data directory and requires a path value. parseSendArgs returns "--data-dir requires a value" when the flag has no following argument. Without a value the send command cannot resolve which session store to use.

Source

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

			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
		default:
			positional = append(positional, args[i])
		}
	}

	if useStdin {
		data, err := io.ReadAll(os.Stdin)
		if err != nil {
			return req, "", fmt.Errorf("reading stdin: %w", err)
		}
		req.Message = strings.TrimSpace(string(data))
	}
	if req.Project == "" {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Append the directory: `--data-dir ~/.cc-connect`.
  2. Quote paths containing spaces.
  3. Set the directory variable before invoking, e.g. `: "${DATA_DIR:?}"` in bash.
  4. Use the same data-dir as the running daemon so the session is found.

Example fix

// before
cc-connect send --data-dir --session t-1 --message "hi"
// after
cc-connect send --data-dir ~/.cc-connect --session t-1 --message "hi"
Defensive patterns

Strategy: validation

Validate before calling

: "${DATA_DIR:?DATA_DIR must be set}"
[ -d "$DATA_DIR" ] || { echo "data-dir not a directory"; exit 1; }
cc-connect send --data-dir "$DATA_DIR" --message hi

Prevention

When it happens

Trigger: `cc-connect send --data-dir` as the last argument; `cc-connect send --data-dir --help`; scripting where the directory variable is empty.

Common situations: Running send outside the default data-dir with a variable that never got set; typos in variable names; container environments where the mounted dir path env is missing.

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/0537226386564447. Report an issue: GitHub.