chenhg5/cc-connect · error
missing --chat
Error message
missing --chat
What it means
runTuiTuiMessages requires a target chat for the `messages` command; if parseTuiTuiArgs leaves opts.chatID empty it aborts via fatalTuiTui. The CLI cannot know which conversation to fetch without --chat.
Source
Thrown at cmd/cc-connect/tuitui.go:73
limit int
orderAsc *bool
query string
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,
})View on GitHub (pinned to 4000b2338a)
Solutions
- Add `--chat <chat_id>` to the tuitui command
- Find the chat id via `cc-connect tuitui search --chat <id> --q <term>` after supplying a known chat, or from the platform UI
- Run `cc-connect tuitui --help` to confirm the flag name
Example fix
// before cc-connect tuitui messages // after cc-connect tuitui messages --chat oc_123456
Defensive patterns
Strategy: validation
Validate before calling
if len(os.Args) > 0 && !slices.Contains(os.Args, "--chat") {
return errors.New("missing --chat")
} Prevention
- Always pass --chat explicitly; there is no default chat
- Store the chat id in a script variable and assert it is non-empty before invoking
- Check `cc-connect tuitui --help` when unsure which subcommand needs which flag
When it happens
Trigger: Running `cc-connect tuitui messages` (or `search`) without passing `--chat <id>` on the command line.
Common situations: Forgetting the flag when scripting, assuming a default chat exists (none does), or copying a command example that omitted the argument.
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/33456fc3d247a1f1.
Report an issue: GitHub.