{"record":{"id":"637737d85eae1ac6","repo":"JuliusBrussee/caveman","slug":"usage-caveman-proxy-learn-applied-sink-id-fix-kind-k-note-s","errorCode":null,"errorMessage":"usage: caveman-proxy learn applied <sink_id> [--fix-kind <k>] [--note <s>]","messagePattern":"usage: caveman-proxy learn applied <sink_id> \\[--fix-kind <k>\\] \\[--note <s>\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":739,"sourceCode":"\t\tsavings, err := spend.BuildLearnSavings(cwd, sources, since)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\tprintJSON(savings)\n\tcase \"apply\":\n\t\tsinkID := firstPositional(args)\n\t\tif sinkID == \"\" {\n\t\t\tfatalJSON(logger, fmt.Errorf(\"usage: caveman-proxy learn apply <sink_id> [--dry-run]\"))\n\t\t}\n\t\tplan, err := spend.BuildLearnPlan(cwd, sources, since)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\tapplyLearnSink(logger, home, sinkID, hasArg(args, \"--dry-run\"), plan)\n\tcase \"applied\":\n\t\tsinkID := firstPositional(args)\n\t\tif sinkID == \"\" {\n\t\t\tfatalJSON(logger, fmt.Errorf(\"usage: caveman-proxy learn applied <sink_id> [--fix-kind <k>] [--note <s>]\"))\n\t\t}\n\t\tplan, err := spend.BuildLearnPlanFilteredWithRetro(cwd, sources, since, store.RetroOptions{}, repoFilter)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\trecorded, err := spend.RecordAppliedFix(plan, sinkID, argFlag(args, \"--fix-kind\", \"\"), argFlag(args, \"--note\", \"\"))\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)\n\t\t}\n\t\tprintJSON(recorded)\n\tcase \"simulate\":\n\t\tsinkIDs := learnSinkPositionals(args)\n\t\tif len(sinkIDs) == 0 {\n\t\t\tfatalJSON(logger, fmt.Errorf(\"usage: caveman-proxy learn simulate <sink_id> [<sink_id>...] [--sources <list>] [--since <window>]\"))\n\t\t}\n\t\tsimulation, err := spend.BuildLearnSimulationFiltered(cwd, sources, since, sinkIDs, repoFilter)\n\t\tif err != nil {\n\t\t\tfatalJSON(logger, err)","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L721-L757","documentation":"Thrown by runLearn's `applied` branch when the positional sink id is missing: `caveman-proxy learn applied <sink_id> [--fix-kind <k>] [--note <s>]`. This subcommand records that a fix was actually applied for a sink, so RecordAppliedFix needs the sink id to key the record.","triggerScenarios":"`caveman-proxy learn applied`, or passing only flags like `--fix-kind note --note \"x\"` without the bare sink id positional.","commonSituations":"Recording applied fixes in automation/scripts where the sink id variable was empty; confusing `learn applied` (records a fix) with `learn apply` (materializes a candidate) and omitting the id in both.","solutions":["Provide the sink id positional: `caveman-proxy learn applied <sink_id> --fix-kind <k> --note <s>`.","Get valid sink ids from `learn scan` or `learn report --json`.","In scripts, fail fast if the sink id variable is empty before invoking the CLI."],"exampleFix":"// before\ncaveman-proxy learn applied --fix-kind config --note \"trimmed CLAUDE.md\"\n// after\ncaveman-proxy learn applied context-overload-7f3a --fix-kind config --note \"trimmed CLAUDE.md\"","handlingStrategy":"validation","validationCode":"// shell\nif [ -z \"$SINK_ID\" ]; then echo \"learn applied requires a positional sink_id\" >&2; exit 2; fi\ncaveman-proxy learn applied \"$SINK_ID\" --fix-kind \"$KIND\" --note \"$NOTE\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass the sink id as the first positional after the subcommand.","Don't confuse learn applied (records a fix) with learn apply (materializes a candidate).","Fail fast in scripts when the sink id variable is empty."],"tags":["cli","missing-argument","learn"],"backgroundTag":"missing-cli-argument","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}