{"record":{"id":"c06c509239948d0c","repo":"ruvnet/ruflo","slug":"plan-not-approved","errorCode":"PLAN_NOT_APPROVED","errorMessage":"Plan ${planId} is not pending (status: ${plan.status})","messagePattern":"Plan (.+?) is not pending \\(status: (.+?)\\)","errorType":"exception","errorClass":"TeammateError","httpStatus":null,"severity":"error","filePath":"v3/plugins/teammate-plugin/src/teammate-bridge.ts","lineNumber":1253,"sourceCode":"      payload: fullPlan,\n    });\n\n    this.emit('plan:submitted', { team: teamName, plan: fullPlan });\n\n    return fullPlan;\n  }\n\n  /**\n   * Approve a plan\n   */\n  async approvePlan(teamName: string, planId: string, approverId: string): Promise<void> {\n    this.ensureAvailable();\n\n    const team = this.getTeamOrThrow(teamName);\n    const plan = this.getPlanOrThrow(team, planId);\n\n    if (plan.status !== 'pending') {\n      throw new TeammateError(\n        `Plan ${planId} is not pending (status: ${plan.status})`,\n        TeammateErrorCode.PLAN_NOT_APPROVED,\n        teamName\n      );\n    }\n\n    if (!plan.approvals.includes(approverId)) {\n      plan.approvals.push(approverId);\n    }\n\n    this.emit('plan:approval_added', { team: teamName, planId, approverId });\n\n    // Check if we have enough approvals\n    if (plan.approvals.length >= plan.requiredApprovals) {\n      plan.status = 'approved';\n      plan.approvedAt = new Date();\n      this.emit('plan:approved', { team: teamName, plan });\n    }","sourceCodeStart":1235,"sourceCodeEnd":1271,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/plugins/teammate-plugin/src/teammate-bridge.ts#L1235-L1271","documentation":"approvePlan() found the plan but its status is not 'pending' — it was already approved, rejected, or completed. State-transition guard: approval is only valid once, from the pending state; the current status is included for diagnosis.","triggerScenarios":"Thrown at v3/plugins/teammate-plugin/src/teammate-bridge.ts:1253 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the plan status before acting; only pending plans can be approved/rejected."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}