{"record":{"id":"8513f569f31314ce","repo":"ruvnet/ruflo","slug":"delegation-depth-exceeded","errorCode":"DELEGATION_DEPTH_EXCEEDED","errorMessage":"Delegation depth exceeded (max: ${this.config.delegation.maxDepth})","messagePattern":"Delegation depth exceeded \\(max: (.+?)\\)","errorType":"exception","errorClass":"TeammateError","httpStatus":null,"severity":"error","filePath":"v3/plugins/teammate-plugin/src/teammate-bridge.ts","lineNumber":1406,"sourceCode":"    this.ensureAvailable();\n\n    const team = this.getTeamOrThrow(teamName);\n\n    // Check if source has these permissions or delegation rights\n    const fromTeammate = team.teammates.find(t => t.id === fromId);\n    if (!fromTeammate) {\n      throw new TeammateError(\n        `Teammate ${fromId} not found`,\n        TeammateErrorCode.TEAMMATE_NOT_FOUND,\n        teamName,\n        fromId\n      );\n    }\n\n    // Check delegation depth\n    const existingDelegationChain = this.getDelegationChain(team, fromId);\n    if (existingDelegationChain.length >= this.config.delegation.maxDepth) {\n      throw new TeammateError(\n        `Delegation depth exceeded (max: ${this.config.delegation.maxDepth})`,\n        TeammateErrorCode.DELEGATION_DEPTH_EXCEEDED,\n        teamName\n      );\n    }\n\n    const delegation: DelegationRecord = {\n      id: generateId('delegation'),\n      fromId,\n      toId,\n      permissions,\n      grantedAt: new Date(),\n      expiresAt: this.config.delegation.autoExpireMs\n        ? new Date(Date.now() + this.config.delegation.autoExpireMs)\n        : undefined,\n      depth: existingDelegationChain.length + 1,\n      active: true,\n    };","sourceCodeStart":1388,"sourceCodeEnd":1424,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/plugins/teammate-plugin/src/teammate-bridge.ts#L1388-L1424","documentation":"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.","triggerScenarios":"Thrown at v3/plugins/teammate-plugin/src/teammate-bridge.ts:1406 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the delegation chain length, or raise config.delegation.maxDepth if the depth is legitimate."],"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-14T05:17:10.506Z"}