{"record":{"id":"871e58d23d40414f","repo":"JuliusBrussee/caveman","slug":"unknown-learn-subcommand-s","errorCode":null,"errorMessage":"unknown learn subcommand: %s","messagePattern":"unknown learn subcommand: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/cmd/caveman-proxy/main.go","lineNumber":761,"sourceCode":"\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)\n\t\t}\n\t\tprintJSON(simulation)\n\tdefault:\n\t\tfatalJSON(logger, fmt.Errorf(\"unknown learn subcommand: %s\", sub))\n\t}\n}\n\nvar positionalValueFlags = map[string]bool{\n\t\"--agent\": true, \"--behavior-budget-ms\": true, \"--build\": true,\n\t\"--command\": true, \"--decision\": true, \"--exit-code\": true,\n\t\"--fix-kind\": true, \"--note\": true, \"--out\": true, \"--path\": true,\n\t\"--plan\": true, \"--port\": true, \"--recent\": true, \"--repo\": true,\n\t\"--retro-budget-ms\": true, \"--session\": true, \"--since\": true,\n\t\"--sources\": true, \"--trial-id\": true, \"--write-report-token\": true,\n}\n\nfunc learnSinkPositionals(args []string) []string {\n\tvar ids []string\n\tfor i := 0; i < len(args); i++ {\n\t\targ := args[i]\n\t\tif strings.HasPrefix(arg, \"--\") {\n\t\t\tif !strings.Contains(arg, \"=\") && positionalValueFlags[arg] && i+1 < len(args) {","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/cmd/caveman-proxy/main.go#L743-L779","documentation":"Thrown by runLearn's default branch when the first argument is not one of scan|report|savings|apply|applied|simulate. Note `learn` defaults to `scan` when no subcommand is given, so this only fires for a non-empty unrecognized subcommand.","triggerScenarios":"`caveman-proxy learn analyze`, `learn optimise` (typo), `learn list`, or any misspelling of the six valid subcommands.","commonSituations":"Guessing subcommand names (`learn suggestions`, `learn fixes`); mixing up singular/plural (`apply` vs `applied` are distinct subcommands); scripts ported from an older CLI layout.","solutions":["Use one of: `caveman-proxy learn scan|report|savings|apply|applied|simulate`.","Run bare `caveman-proxy learn` — it defaults to `scan` and shows what the scan path does.","Check spelling, especially apply vs applied which are both valid but mean different things."],"exampleFix":"// before\ncaveman-proxy learn analyze\n// after\ncaveman-proxy learn scan","handlingStrategy":"validation","validationCode":"// shell\ncase \"$SUB\" in scan|report|savings|apply|applied|simulate) ;; *) echo \"learn subcommands: scan|report|savings|apply|applied|simulate\" >&2; exit 2;; esac\ncaveman-proxy learn \"$SUB\" \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Valid subcommands: scan, report, savings, apply, applied, simulate (default is scan).","Note apply vs applied are distinct — check spelling.","Consult --help rather than guessing names."],"tags":["cli","invalid-subcommand","learn"],"backgroundTag":"invalid-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"}