{"record":{"id":"0a46f69b85c7f798","repo":"chenhg5/cc-connect","slug":"message-requires-a-value","errorCode":null,"errorMessage":"--message requires a value","messagePattern":"--message requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/send.go","lineNumber":97,"sourceCode":"\tvar positional []string\n\n\tfor i := 0; i < len(args); i++ {\n\t\tswitch args[i] {\n\t\tcase \"--project\", \"-p\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--project requires a value\")\n\t\t\t}\n\t\t\ti++\n\t\t\treq.Project = args[i]\n\t\tcase \"--session\", \"-s\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--session requires a value\")\n\t\t\t}\n\t\t\ti++\n\t\t\treq.SessionKey = args[i]\n\t\tcase \"--message\", \"-m\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--message requires a value\")\n\t\t\t}\n\t\t\ti++\n\t\t\treq.Message = args[i]\n\t\tcase \"--cwd\", \"--work-dir\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"%s requires a value\", args[i])\n\t\t\t}\n\t\t\ti++\n\t\t\treq.WorkDir = args[i]\n\t\tcase \"--tts\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"%s requires a value\", args[i])\n\t\t\t}\n\t\t\ti++\n\t\t\treq.TTSText = args[i]\n\t\tcase \"--image\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--image requires a path\")","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/send.go#L79-L115","documentation":"A sentinel from the send-command argument parser: the --message/-m flag appeared as the last argument with no following value. Strict per-flag arity validation rejects it before any message can be composed.","triggerScenarios":"Running `cc-connect send --message` or `-m` with no following text token.","commonSituations":"Message built from an empty shell variable; quoting errors cause the text to be eaten; user omits the text after the flag.","solutions":["Supply the text: `cc-connect send -m \"your message\"`.","Quote the message so spaces/newlines survive shell parsing.","If sending only an attachment, omit -m entirely (attachment-only sends are allowed)."],"exampleFix":"// before (MSG empty)\ncc-connect send -m $MSG\n// after\ncc-connect send -m \"${MSG:?message is required}\"","handlingStrategy":"validation","validationCode":"# shell\n[ -n \"$MSG\" ] || [ -n \"$AUDIO\" ] || { echo \"--message requires a value (or provide an attachment)\"; exit 2; }\ncc-connect send -m \"$MSG\"","typeGuard":null,"tryCatchPattern":"req, _, err := parseSendArgs(args)\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"flag error: %v\\n\", err)\n    os.Exit(2)\n}","preventionTips":["Always quote the message text: -m \"...\".","Use ${MSG:?} expansion to fail fast on empty variables.","Remember attachment-only sends are valid — drop -m rather than passing it bare."],"tags":["go","cli","flag-parsing"],"backgroundTag":"missing-cli-argument","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}