ruvnet/ruflo · error · TeammateError

DELEGATION_DEPTH_EXCEEDED

DELEGATION_DEPTH_EXCEEDED

Error message

Delegation depth exceeded (max: ${this.config.delegation.maxDepth})

What it means

grantDelegation computed the source teammate's existing delegation chain and its length already meets config.delegation.maxDepth. Granting another hop would exceed the configured delegation-depth ceiling (a policy guard against unbounded permission chains), so the grant is refused.

Solutions

  1. Reduce the delegation chain length, or raise config.delegation.maxDepth if the depth is legitimate.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/plugins/teammate-plugin/src/teammate-bridge.ts:1406 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/8513f569f31314ce. Report an issue: GitHub.

Appendix: source

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

    this.ensureAvailable();

    const team = this.getTeamOrThrow(teamName);

    // Check if source has these permissions or delegation rights
    const fromTeammate = team.teammates.find(t => t.id === fromId);
    if (!fromTeammate) {
      throw new TeammateError(
        `Teammate ${fromId} not found`,
        TeammateErrorCode.TEAMMATE_NOT_FOUND,
        teamName,
        fromId
      );
    }

    // Check delegation depth
    const existingDelegationChain = this.getDelegationChain(team, fromId);
    if (existingDelegationChain.length >= this.config.delegation.maxDepth) {
      throw new TeammateError(
        `Delegation depth exceeded (max: ${this.config.delegation.maxDepth})`,
        TeammateErrorCode.DELEGATION_DEPTH_EXCEEDED,
        teamName
      );
    }

    const delegation: DelegationRecord = {
      id: generateId('delegation'),
      fromId,
      toId,
      permissions,
      grantedAt: new Date(),
      expiresAt: this.config.delegation.autoExpireMs
        ? new Date(Date.now() + this.config.delegation.autoExpireMs)
        : undefined,
      depth: existingDelegationChain.length + 1,
      active: true,
    };

View on GitHub (pinned to fa13ee4ad6)