{"record":{"id":"ebe7bba02126e742","repo":"JuliusBrussee/caveman","slug":"sink-q-not-found-in-current-learn-plan-simulate","errorCode":null,"errorMessage":"sink %q not found in current learn plan","messagePattern":"sink %q not found in current learn plan","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/store/learn_simulate.go","lineNumber":68,"sourceCode":"\t\t\t\"Counterfactual covers only content and provider-counted turns actually scanned; it is never projected forward and never converted to dollars.\",\n\t\t\t\"Config and recurring-context methods are summed only under the assumption that they describe disjoint content.\",\n\t\t},\n\t}\n\tbyID := make(map[string]Sink, len(plan.Sinks))\n\tfor _, sink := range plan.Sinks {\n\t\tbyID[sink.SinkID] = sink\n\t}\n\tunique := map[string]bool{}\n\tfor _, id := range sinkIDs {\n\t\tid = strings.TrimSpace(id)\n\t\tif id != \"\" {\n\t\t\tunique[id] = true\n\t\t}\n\t}\n\tids := make([]string, 0, len(unique))\n\tfor id := range unique {\n\t\tif _, ok := byID[id]; !ok {\n\t\t\treturn LearnSimulation{}, fmt.Errorf(\"sink %q not found in current learn plan\", id)\n\t\t}\n\t\tids = append(ids, id)\n\t}\n\tif len(ids) == 0 {\n\t\treturn LearnSimulation{}, fmt.Errorf(\"at least one sink id is required\")\n\t}\n\tsort.Strings(ids)\n\n\t// One owner per config file/family. Prefer broader measured weight, then sink\n\t// id, so overlap refusal is stable regardless of CLI argument order.\n\towners := map[string]string{}\n\tfor _, id := range ids {\n\t\tsink := byID[id]\n\t\tkey := simulationOverlapKey(sink)\n\t\tif key == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\towner, exists := owners[key]","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/internal/store/learn_simulate.go#L50-L86","documentation":"simulateLearnPlan collects the unique sink ids the caller asked to simulate and verifies each one exists in the current learn plan's byID map. If a requested id is absent from the plan, simulation cannot produce a row for it and the whole operation errors out rather than partially simulating. This prevents silently dropping sinks the user explicitly named.","triggerScenarios":"Calling BuildLearnSimulationFiltered with a sink id (from the filtered CLI selection) that does not match any sink in the plan produced for the current window, e.g. a stale or mistyped id.","commonSituations":"Copy-pasting a sink id from an older plan/README; ids changed after re-running the learn scan; quoting/whitespace mistakes in CLI arguments; simulating against a different cwd than the plan was built for.","solutions":["Re-run the learn plan generation and copy the sink id exactly from its output","Run the unfiltered simulation to list valid sink ids, then retry with one of those","Check for typos, stale ids, or shell quoting issues in the id argument"],"exampleFix":"// before\nstore.BuildLearnSimulationFiltered(plan, []string{\"AGENTS.md:stale-id\"})\n// after\nid := \"AGENTS.md:current-id-from-plan\" // re-read from plan output\nstore.BuildLearnSimulationFiltered(plan, []string{id})","handlingStrategy":"validation","validationCode":"valid := make(map[string]bool, len(plan.Sinks))\nfor _, s := range plan.Sinks { valid[s.ID] = true }\nfor _, id := range requested {\n    if !valid[id] { return fmt.Errorf(\"unknown sink id %q; run the plan listing to see valid ids\", id) }\n}","typeGuard":null,"tryCatchPattern":"if _, err := store.BuildLearnSimulationFiltered(plan, ids); err != nil {\n    if strings.Contains(err.Error(), \"not found in current learn plan\") {\n        return fmt.Errorf(\"stale or unknown sink id; regenerate the plan: %w\", err)\n    }\n    return err\n}","preventionTips":["Always copy sink ids from the current plan output, never from old sessions","List available sinks first, then select from that list in scripts","Trim and quote CLI arguments to avoid whitespace mismatches","Regenerate the plan whenever the scan window or cwd changes"],"tags":["cli","learn-simulate","lookup"],"backgroundTag":"entity-not-found","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"}