{"record":{"id":"80e2b5e1860891ae","repo":"ruvnet/ruflo","slug":"rollout-not-found-rolloutid","errorCode":null,"errorMessage":"Rollout not found: ${rolloutId}","messagePattern":"Rollout not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/guidance/src/evolution.ts","lineNumber":505,"sourceCode":"  }\n\n  // ==========================================================================\n  // Advance Stage\n  // ==========================================================================\n\n  /**\n   * Advance to the next rollout stage or auto-rollback.\n   *\n   * If `stageMetrics.divergence` exceeds the current stage's threshold,\n   * the rollout is automatically rolled back.\n   */\n  advanceStage(\n    rolloutId: string,\n    stageMetrics: Record<string, number>,\n  ): { advanced: boolean; rolledBack: boolean; reason: string } {\n    const rollout = this.rollouts.get(rolloutId);\n    if (!rollout) {\n      throw new Error(`Rollout not found: ${rolloutId}`);\n    }\n\n    if (rollout.status !== 'in-progress') {\n      return {\n        advanced: false,\n        rolledBack: false,\n        reason: `Rollout is ${rollout.status}, not in-progress`,\n      };\n    }\n\n    const current = rollout.stages[rollout.currentStage];\n    const now = Date.now();\n\n    // Record metrics on the current stage\n    current.metrics = { ...stageMetrics };\n\n    // Check divergence against threshold\n    const divergence = stageMetrics.divergence ?? 0;","sourceCodeStart":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/guidance/src/evolution.ts#L487-L523","documentation":"EvolutionPipeline.advanceStage() moves a staged rollout to its next stage or auto-rolls back when divergence exceeds the stage threshold. Rollouts live in the in-memory `rollouts` Map and their IDs are only minted by stage(), so this error means the rolloutId was never issued by this pipeline instance (or was lost to a restart). It is checked before the in-progress status check, so an unknown ID always throws rather than returning a reason object.","triggerScenarios":"Calling `advanceStage(rolloutId, metrics)` with an ID not returned by stage(); pipeline restarted between staging and advancing (Map lost); advancing on a different pipeline instance than the one that staged; copying the rolloutId from logs with a typo.","commonSituations":"Long-running canary jobs that sleep between stages and survive a redeploy; metrics-collection workers calling advanceStage from a separate process; replaying operational runbooks against a fresh pipeline.","solutions":["Use the rolloutId captured from `const rollout = pipeline.stage(proposalId)`","Guard with `if (!pipeline.getRollout(rolloutId)) return;` before advancing","Re-create the rollout (stage again on a live proposal) after a restart","Keep stage()/advanceStage() calls on one long-lived pipeline instance"],"exampleFix":"// before\nconst r = pipeline.advanceStage(savedRolloutId, metrics); // throws after restart\n\n// after\nconst existing = pipeline.getRollout(savedRolloutId);\nif (existing) {\n  const r = pipeline.advanceStage(savedRolloutId, metrics);\n} else {\n  const rollout = pipeline.stage(liveProposalId); // re-stage, then advance\n  const r = pipeline.advanceStage(rollout.rolloutId, metrics);\n}","handlingStrategy":"validation","validationCode":"if (pipeline.getRollout(rolloutId) === undefined) {\n  // rollout unknown to this instance — re-stage before advancing\n}","typeGuard":null,"tryCatchPattern":"try {\n  const r = pipeline.advanceStage(rolloutId, metrics);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Rollout not found')) {\n    // restart wiped rollouts — re-stage the proposal\n  } else throw err;\n}","preventionTips":["Capture the rolloutId from stage() and pass it unchanged to advanceStage()","Keep canary/advance jobs on the same long-lived pipeline instance","Check getRollout() before deferred advance jobs run"],"tags":["evolution","rollout","guidance","not-found","canary-deploy"],"backgroundTag":"entity-not-found","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}