ruvnet/ruflo · error · TeammateError

PLAN_NOT_APPROVED

PLAN_NOT_APPROVED

Error message

Plan ${planId} is not pending (status: ${plan.status})

What it means

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.

Source

Thrown at v3/plugins/teammate-plugin/src/teammate-bridge.ts:1253

      payload: fullPlan,
    });

    this.emit('plan:submitted', { team: teamName, plan: fullPlan });

    return fullPlan;
  }

  /**
   * Approve a plan
   */
  async approvePlan(teamName: string, planId: string, approverId: string): Promise<void> {
    this.ensureAvailable();

    const team = this.getTeamOrThrow(teamName);
    const plan = this.getPlanOrThrow(team, planId);

    if (plan.status !== 'pending') {
      throw new TeammateError(
        `Plan ${planId} is not pending (status: ${plan.status})`,
        TeammateErrorCode.PLAN_NOT_APPROVED,
        teamName
      );
    }

    if (!plan.approvals.includes(approverId)) {
      plan.approvals.push(approverId);
    }

    this.emit('plan:approval_added', { team: teamName, planId, approverId });

    // Check if we have enough approvals
    if (plan.approvals.length >= plan.requiredApprovals) {
      plan.status = 'approved';
      plan.approvedAt = new Date();
      this.emit('plan:approved', { team: teamName, plan });
    }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Check the plan status before acting; only pending plans can be approved/rejected.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/plugins/teammate-plugin/src/teammate-bridge.ts:1253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/c06c509239948d0c. Report an issue: GitHub.