{"record":{"id":"8e7f0d41337e3612","repo":"ruvnet/ruflo","slug":"proposal-not-found-proposalid","errorCode":null,"errorMessage":"Proposal not found: ${proposalId}","messagePattern":"Proposal not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/guidance/src/evolution.ts","lineNumber":319,"sourceCode":"    return proposal;\n  }\n\n  // ==========================================================================\n  // Simulate\n  // ==========================================================================\n\n  /**\n   * Run golden traces through both baseline and candidate configs to measure\n   * divergence. The evaluator is called once per golden trace per config.\n   */\n  simulate(\n    proposalId: string,\n    goldenTraces: unknown[],\n    evaluator: TraceEvaluator,\n  ): SimulationResult {\n    const proposal = this.proposals.get(proposalId);\n    if (!proposal) {\n      throw new Error(`Proposal not found: ${proposalId}`);\n    }\n\n    proposal.status = 'simulating';\n\n    // Evaluate each trace against both configs\n    const baselineResults = goldenTraces.map(t => evaluator(t, 'baseline'));\n    const candidateResults = goldenTraces.map(t => evaluator(t, 'candidate'));\n\n    // Compute composite trace hashes\n    const baselineTraceHash = this.hashTraceResults(baselineResults.map(r => r.traceHash));\n    const candidateTraceHash = this.hashTraceResults(candidateResults.map(r => r.traceHash));\n\n    // Compute decision diffs\n    const decisionDiffs: DecisionDiff[] = [];\n    for (let i = 0; i < goldenTraces.length; i++) {\n      const bDecisions = baselineResults[i].decisions;\n      const cDecisions = candidateResults[i].decisions;\n      const maxLen = Math.max(bDecisions.length, cDecisions.length);","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/guidance/src/evolution.ts#L301-L337","documentation":"EvolutionPipeline.simulate() runs golden traces through baseline and candidate configs for a change proposal stored in the in-memory `proposals` Map, keyed by the ID returned from propose(). It throws when that ID is unknown — typically a stale ID from before a restart or a typo'd/copied value. Simulation is the first lifecycle step that consumes a proposal, so it is often where an invalid ID is discovered.","triggerScenarios":"Calling `pipeline.simulate(id, traces, evaluator)` with an ID not returned by propose(); pipeline process restarted between propose() and simulate(); ID passed through queues/logs and mangled.","commonSituations":"Proposing in one service instance and simulating in another; long queues between propose and simulate surviving a redeploy; test code hard-coding IDs from a previous run.","solutions":["Use the exact proposalId returned by `pipeline.propose(...)`","Guard with `if (!pipeline.getProposal(proposalId)) return;` before simulating","Re-propose if the pipeline restarted (state is in-memory)","Keep the whole propose→simulate→compare→stage→advance lifecycle on one pipeline instance"],"exampleFix":"// before\nconst sim = pipeline.simulate(hardcodedId, traces, evaluator); // throws\n\n// after\nif (pipeline.getProposal(hardcodedId)) {\n  const sim = pipeline.simulate(hardcodedId, traces, evaluator);\n} else {\n  const { proposalId } = pipeline.propose(changes);\n  const sim = pipeline.simulate(proposalId, traces, evaluator);\n}","handlingStrategy":"validation","validationCode":"if (pipeline.getProposal(proposalId) === undefined) {\n  // stale/unknown ID — re-propose instead of simulating\n}","typeGuard":null,"tryCatchPattern":"try {\n  const sim = pipeline.simulate(proposalId, traces, evaluator);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Proposal not found')) {\n    // restart wiped the Map — re-propose and retry once\n  } else throw err;\n}","preventionTips":["Store the proposalId from propose() and thread it verbatim","Keep the propose→simulate→compare→stage lifecycle on one instance","Assume in-memory proposals do not survive restarts"],"tags":["evolution","proposal","guidance","not-found","in-memory-state"],"backgroundTag":"entity-not-found","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}