{"record":{"id":"898fbeb6a6dc65d7","repo":"ruvnet/ruflo","slug":"invalid-worker-capability-envelope","errorCode":null,"errorMessage":"invalid-worker-capability-envelope","messagePattern":"invalid-worker-capability-envelope","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/policy-runtime.ts","lineNumber":331,"sourceCode":"    destructive?: boolean;\n    namespaceAccess?: 'read' | 'write';\n    envelope?: CapabilityEnvelope;\n    costUsd?: number;\n    tokens?: number;\n    concurrency?: number;\n  }> = {},\n): Promise<PolicyDecision> {\n  let projectRoot = typeof context.projectRoot === 'string' ? context.projectRoot : process.cwd();\n  let processEnvelope: CapabilityEnvelope | undefined;\n  if (process.env.CLAUDE_FLOW_CAPABILITY_ENVELOPE) {\n    try {\n      const parsed = JSON.parse(process.env.CLAUDE_FLOW_CAPABILITY_ENVELOPE) as unknown;\n      if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n        throw new Error('not an object');\n      }\n      processEnvelope = parsed as CapabilityEnvelope;\n    } catch {\n      throw new Error('invalid-worker-capability-envelope');\n    }\n    // Linked git worktrees share one immutable common git directory. Derive\n    // the coordinator checkout from that directory so a worker cannot fall\n    // back to independent legacy policy state in its isolated worktree.\n    try {\n      const cwd = realpathSync(process.cwd());\n      const common = execFileSync(\n        'git',\n        ['-C', cwd, 'rev-parse', '--path-format=absolute', '--git-common-dir'],\n        { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] },\n      ).trim();\n      projectRoot = dirname(realpathSync(common));\n    } catch {\n      throw new Error('authoritative-worker-policy-root-unavailable');\n    }\n  }\n  return evaluatePolicyRequest({\n    identity: {","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/policy-runtime.ts#L313-L349","documentation":"authorizeMcpTool() parsed the CLAUDE_FLOW_CAPABILITY_ENVELOPE environment variable and found it malformed — the value is not a valid CapabilityEnvelope (wrong shape, non-object JSON, or failed envelope validation). The worker's capability envelope cannot be established, so authorization is refused.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/policy-runtime.ts:331 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rebuild the worker capability envelope from the authoritative policy root","Remove any locally modified envelope fields"],"exampleFix":"Issue the worker a valid capability envelope (correct schema and signature); do not hand-craft envelopes.","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"}