{"record":{"id":"5721ac2656fe9844","repo":"chenhg5/cc-connect","slug":"project-requires-a-value","errorCode":null,"errorMessage":"--project requires a value","messagePattern":"--project requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/send.go","lineNumber":85,"sourceCode":"}\n\nvar errSendUsage = errors.New(\"show send usage\")\n\nfunc parseSendArgs(args []string) (core.SendRequest, string, error) {\n\tvar req core.SendRequest\n\tvar dataDir string\n\tvar useStdin bool\n\tvar imagePaths []string\n\tvar filePaths []string\n\tvar audioPaths []string\n\tvar videoPaths []string\n\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])","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/send.go#L67-L103","documentation":"parseSendArgs parses CLI arguments for `cc-connect send`. When --project (or -p) is passed as the last argument with nothing after it, there is no value to assign to req.Project, so it returns this error. It is a guard against truncated flag usage.","triggerScenarios":"Running `cc-connect send --project` or `cc-connect send -p` with no following token (flag at end of argv).","commonSituations":"Shell scripts building the command conditionally drop the project name; users forget the value; copy-paste truncates the command line.","solutions":["Provide a value: `cc-connect send --project <project-name> ...`.","If the value is optional in your script, omit the flag entirely instead of passing it bare.","Check shell quoting/variable expansion so the value isn't lost before exec."],"exampleFix":"// before\ncc-connect send -p -m \"hello\"\n// after\ncc-connect send -p myproject -m \"hello\"","handlingStrategy":"validation","validationCode":"# shell: verify flag has a value before invoking\n[ -n \"$PROJECT\" ] || { echo \"--project requires a value\"; exit 2; }","typeGuard":null,"tryCatchPattern":"req, _, err := parseSendArgs(os.Args[2:])\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"usage: cc-connect send [--project <name>] ...\\n%v\\n\", err)\n    os.Exit(2)\n}","preventionTips":["Always quote and verify shell variables used for flag values.","Build argv with arrays so empty variables don't silently vanish.","Check `cc-connect send --help` for flag/value pairing."],"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"}