chenhg5/cc-connect · error

message, tts text, or attachment is required

Error message

message, tts text, or attachment is required

What it means

parseSendArgs rejects requests that carry no content at all: message, TTS text, and all attachment lists (images, files, audios, videos) empty. This final validation prevents sending a pointless/empty message to the platform. It fires even when valid flags like --work-dir were given, since they carry no user content.

Source

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

		return req, "", err
	}
	videoFiles, err := loadTypedFileAttachments(videoPaths, "video", maxAtt)
	if err != nil {
		return req, "", err
	}
	req.Images = images
	// Keep audio / video clips on dedicated fields. Routing them through
	// req.Files would force the engine to dispatch them via FileSender —
	// that loses the native voice-bubble / video-bubble path on platforms
	// that implement AudioSender / VideoSender (e.g. Feishu's ffmpeg
	// transcode for mp3 → opus). See cc-connect internal task
	// t-20260615-cqjbk1.
	req.Files = files
	req.Audios = audioFiles
	req.Videos = videoFiles

	if req.Message == "" && req.TTSText == "" && len(req.Images) == 0 && len(req.Files) == 0 && len(req.Audios) == 0 && len(req.Videos) == 0 {
		return req, "", fmt.Errorf("message, tts text, or attachment is required")
	}

	return req, dataDir, nil
}

func loadImageAttachments(paths []string, maxSize int64) ([]core.ImageAttachment, error) {
	images := make([]core.ImageAttachment, 0, len(paths))
	for _, path := range paths {
		data, fileName, mimeType, err := readAttachment(path, maxSize)
		if err != nil {
			return nil, err
		}
		if !strings.HasPrefix(mimeType, "image/") {
			return nil, fmt.Errorf("%s is not an image (detected mime: %s)", path, mimeType)
		}
		images = append(images, core.ImageAttachment{MimeType: mimeType, Data: data, FileName: fileName})
	}
	return images, nil

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Provide content: add `--message "..."`, `--tts "..."`, or at least one --image/--file/--audio/--video.
  2. If piping via --stdin, verify the producer emits non-empty output (whitespace-only stdin is trimmed to empty).
  3. In scripts, guard: `[ -n "$MSG" ] || cc-connect send --image "$IMG" ...`.
  4. Check the config/source that was supposed to supply the message text.

Example fix

// before
cc-connect send --work-dir /proj
// after
cc-connect send --work-dir /proj --message "run the tests"
Defensive patterns

Strategy: validation

Validate before calling

MSG=${MSG:-}
if [ -z "$MSG" ] && [ -z "$IMG" ] && [ -z "$FILE" ]; then
  echo "nothing to send"; exit 1
fi
cmd=(cc-connect send)
[ -n "$MSG" ] && cmd+=(--message "$MSG")
[ -n "$IMG" ] && cmd+=(--image "$IMG")

Prevention

When it happens

Trigger: `cc-connect send --work-dir /p` with no --message, --tts, or attachment flags; `--stdin` used but stdin was empty; attachment variables empty so no --image/--file flags were added.

Common situations: Automated scripts where the message variable is empty and no attachments resolved; piping an empty string via --stdin; forgetting that flags like --data-dir or --at-users alone do not satisfy the content requirement.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — 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/b035057a9fba03b0. Report an issue: GitHub.