{"record":{"id":"c8e972e43de18d72","repo":"chenhg5/cc-connect","slug":"s-requires-a-value","errorCode":null,"errorMessage":"%s requires a value","messagePattern":"(.+?) requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/send.go","lineNumber":103,"sourceCode":"\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\")\n\t\t\t}\n\t\t\ti++\n\t\t\timagePaths = append(imagePaths, args[i])\n\t\tcase \"--file\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--file requires a path\")","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/send.go#L85-L121","documentation":"parseSendArgs handles --cwd/--work-dir (and similarly --tts) with a shared check: when the flag is the last token, the flag name itself is interpolated into `%s requires a value`. The error reports whichever option was left without its argument.","triggerScenarios":"Running `cc-connect send --cwd` / `--work-dir` (or --tts) as the last argument so no path/value token follows; the message then reads e.g. `--cwd requires a value`.","commonSituations":"Workdir from an empty variable in CI scripts; user forgets the path; flag ordering mistakes where the value is placed before the flag.","solutions":["Append the path: `cc-connect send --cwd /path/to/workdir ...`.","Guard the variable in scripts: use \"${WORKDIR:?}\" so empty values abort early.","Verify argument order — the value must directly follow the flag."],"exampleFix":"// before\ncc-connect send --cwd -m \"hi\"\n// after\ncc-connect send --cwd /srv/myproject -m \"hi\"","handlingStrategy":"validation","validationCode":"# shell\n[ -n \"$WORKDIR\" ] || { echo \"--cwd requires a value\"; exit 2; }\ncc-connect send --cwd \"$WORKDIR\" -m \"hi\"","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":["Pass the path immediately after the flag: --cwd <path>.","Guard path variables with ${WORKDIR:?} in scripts.","Never place the next flag where a value is expected."],"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"}