{"record":{"id":"44d667eb59a8fab4","repo":"chenhg5/cc-connect","slug":"missing-message-or-stdin","errorCode":null,"errorMessage":"missing --message or --stdin","messagePattern":"missing --message or --stdin","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/tuitui.go","lineNumber":154,"sourceCode":"\nfunc runTuiTuiPost(args []string) {\n\topts, err := parseTuiTuiArgs(args)\n\tif err != nil {\n\t\tfatalTuiTui(err)\n\t}\n\tif opts.channelID == \"\" {\n\t\tfatalTuiTui(errors.New(\"missing --channel\"))\n\t}\n\tmessage := opts.message\n\tif opts.stdin {\n\t\tdata, err := io.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\tfatalTuiTui(fmt.Errorf(\"read stdin: %w\", err))\n\t\t}\n\t\tmessage = string(data)\n\t}\n\tif strings.TrimSpace(message) == \"\" {\n\t\tfatalTuiTui(errors.New(\"missing --message or --stdin\"))\n\t}\n\tp, err := loadTuiTuiPlatform(opts)\n\tif err != nil {\n\t\tfatalTuiTui(err)\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\n\tdefer cancel()\n\tif err := p.SendChannelPost(ctx, opts.channelID, message, opts.parentID); err != nil {\n\t\tfatalTuiTui(err)\n\t}\n\tprintJSON(map[string]any{\n\t\t\"ok\":         true,\n\t\t\"channel_id\": opts.channelID,\n\t\t\"parent_id\":  opts.parentID,\n\t})\n}\n\nfunc downloadTuiTuiURL(ctx context.Context, rawURL string, maxBytes int64) ([]byte, string, string, error) {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/tuitui.go#L136-L172","documentation":"runTuiTuiPost requires message content from either --message or --stdin; after resolving both sources it checks the final message is non-empty and aborts otherwise. Posting an empty message is never allowed.","triggerScenarios":"Running `cc-connect tuitui post --channel X` with neither --message nor --stdin, passing an empty --message, or piping empty/whitespace-only data via --stdin.","commonSituations":"Upstream command in a pipe produced no output (`cmd | cc-connect tuitui post --channel X --stdin` when cmd failed), a shell variable holding the text was unset, or forgot the --stdin flag while relying on a pipe.","solutions":["Provide text: add `--message \"...\"` or pipe data with `--stdin`","Check the producing command in a pipeline actually emitted content before posting","Verify the message variable is non-empty in your script"],"exampleFix":"// before\ncc-connect tuitui post --channel C0123\n// after\ncc-connect tuitui post --channel C0123 --stdin < report.txt","handlingStrategy":"validation","validationCode":"msg := message\nif useStdin { b, _ := io.ReadAll(os.Stdin); msg = string(b) }\nif strings.TrimSpace(msg) == \"\" {\n    return errors.New(\"provide --message or non-empty stdin\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When piping via --stdin, check the producing command's exit status first","Fall back to --message if the piped data is empty","Guard script variables holding the message text"],"tags":["cli","tuitui","arguments","post"],"backgroundTag":"missing-required-flag","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}