chenhg5/cc-connect · error

missing --q

Error message

missing --q

What it means

A sentinel validation error raised by runTuiTuiMessages when the tuitui subcommand is 'search' but the parsed options contain a blank/whitespace --q value. It fires because the search operation requires a query string and none was supplied (or it was only whitespace).

Source

Thrown at cmd/cc-connect/tuitui.go:76

	url        string
	outDir     string
	maxBytes   int64
	channelID  string
	parentID   string
	message    string
	stdin      bool
}

func runTuiTuiMessages(command string, args []string) {
	opts, err := parseTuiTuiArgs(args)
	if err != nil {
		fatalTuiTui(err)
	}
	if opts.chatID == "" {
		fatalTuiTui(errors.New("missing --chat"))
	}
	if command == "search" && strings.TrimSpace(opts.query) == "" {
		fatalTuiTui(errors.New("missing --q"))
	}
	p, err := loadTuiTuiPlatform(opts)
	if err != nil {
		fatalTuiTui(err)
	}
	ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
	defer cancel()
	result, err := p.FetchHistory(ctx, opts.chatID, opts.chatType, tuitui.HistoryOptions{
		RelativeTime: opts.relative,
		StartTime:    opts.startTime,
		EndTime:      opts.endTime,
		Cursor:       opts.cursor,
		Limit:        opts.limit,
		OrderAsc:     opts.orderAsc,
	})
	if err != nil {
		fatalTuiTui(err)
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Add a non-empty `--q <search term>` argument
  2. Quote the query if it contains spaces: `--q "deploy failed"`
  3. Check that the variable holding the query is not empty in your script

Example fix

// before
cc-connect tuitui search --chat oc_123 --q ""
// after
cc-connect tuitui search --chat oc_123 --q "deploy failed"
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(query) == "" {
    return errors.New("search requires a non-empty --q")
}

Prevention

When it happens

Trigger: Running `cc-connect tuitui search --chat <id>` without `--q <query>`, or with `--q " "` (whitespace only).

Common situations: Building the command dynamically and an empty query variable, quoting issues that swallow the argument, or forgetting search needs both --chat and --q.

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