{"record":{"id":"0537226386564447","repo":"chenhg5/cc-connect","slug":"data-dir-requires-a-value","errorCode":null,"errorMessage":"--data-dir requires a value","messagePattern":"--data-dir requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/send.go","lineNumber":154,"sourceCode":"\t\t\tvideoPaths = append(videoPaths, args[i])\n\t\tcase \"--stdin\":\n\t\t\tuseStdin = true\n\t\tcase \"--at-users\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--at-users requires a value\")\n\t\t\t}\n\t\t\ti++\n\t\t\tfor _, uid := range strings.Split(args[i], \",\") {\n\t\t\t\tuid = strings.TrimSpace(uid)\n\t\t\t\tif uid != \"\" {\n\t\t\t\t\treq.AtUsers = append(req.AtUsers, uid)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"--at-all\":\n\t\t\treq.AtAll = true\n\t\tcase \"--data-dir\":\n\t\t\tif i+1 >= len(args) {\n\t\t\t\treturn req, \"\", fmt.Errorf(\"--data-dir requires a value\")\n\t\t\t}\n\t\t\ti++\n\t\t\tdataDir = args[i]\n\t\tcase \"--help\", \"-h\":\n\t\t\treturn req, \"\", errSendUsage\n\t\tdefault:\n\t\t\tpositional = append(positional, args[i])\n\t\t}\n\t}\n\n\tif useStdin {\n\t\tdata, err := io.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn req, \"\", fmt.Errorf(\"reading stdin: %w\", err)\n\t\t}\n\t\treq.Message = strings.TrimSpace(string(data))\n\t}\n\tif req.Project == \"\" {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/send.go#L136-L172","documentation":"The --data-dir flag of `cc-connect send` overrides the session data directory and requires a path value. parseSendArgs returns \"--data-dir requires a value\" when the flag has no following argument. Without a value the send command cannot resolve which session store to use.","triggerScenarios":"`cc-connect send --data-dir` as the last argument; `cc-connect send --data-dir --help`; scripting where the directory variable is empty.","commonSituations":"Running send outside the default data-dir with a variable that never got set; typos in variable names; container environments where the mounted dir path env is missing.","solutions":["Append the directory: `--data-dir ~/.cc-connect`.","Quote paths containing spaces.","Set the directory variable before invoking, e.g. `: \"${DATA_DIR:?}\"` in bash.","Use the same data-dir as the running daemon so the session is found."],"exampleFix":"// before\ncc-connect send --data-dir --session t-1 --message \"hi\"\n// after\ncc-connect send --data-dir ~/.cc-connect --session t-1 --message \"hi\"","handlingStrategy":"validation","validationCode":": \"${DATA_DIR:?DATA_DIR must be set}\"\n[ -d \"$DATA_DIR\" ] || { echo \"data-dir not a directory\"; exit 1; }\ncc-connect send --data-dir \"$DATA_DIR\" --message hi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always give --data-dir an explicit path.","Use the same data-dir as the running daemon.","Guard env variables with ${VAR:?} in bash.","Quote paths with spaces."],"tags":["cli","argument-parsing","configuration"],"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"}