{"record":{"id":"c8be461867474ef2","repo":"ruvnet/ruflo","slug":"swarm-state-is-busy-retry-the-outcome-update","errorCode":null,"errorMessage":"swarm state is busy; retry the outcome update","messagePattern":"swarm state is busy; retry the outcome update","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/swarm-tools.ts","lineNumber":188,"sourceCode":"  const lockPath = join(getSwarmDir(), SWARM_STATE_LOCK);\n  let descriptor: number | undefined;\n  const waiter = new Int32Array(new SharedArrayBuffer(4));\n  for (let attempt = 0; attempt < 100; attempt++) {\n    try {\n      descriptor = openSync(lockPath, 'wx', 0o600);\n      break;\n    } catch (error) {\n      if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error;\n      try {\n        if (Date.now() - statSync(lockPath).mtimeMs > SWARM_LOCK_STALE_MS) {\n          unlinkSync(lockPath);\n          continue;\n        }\n      } catch { /* another writer released it */ }\n      Atomics.wait(waiter, 0, 0, 10);\n    }\n  }\n  if (descriptor === undefined) throw new Error('swarm state is busy; retry the outcome update');\n  try {\n    return operation();\n  } finally {\n    try { closeSync(descriptor); } catch { /* best effort */ }\n    try { unlinkSync(lockPath); } catch { /* best effort */ }\n  }\n}\n\n// Input validation\nconst VALID_TOPOLOGIES = new Set([\n  'hierarchical', 'mesh', 'hierarchical-mesh', 'ring', 'star', 'hybrid', 'adaptive', 'pheromone-adaptive',\n]);\n\nfunction latestRunningSwarm(store: SwarmStore): SwarmState | undefined {\n  return Object.values(store.swarms)\n    .filter((swarm) => swarm.status === 'running')\n    .sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime())[0];\n}","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/mcp-tools/swarm-tools.ts#L170-L206","documentation":"Error \"swarm state is busy; retry the outcome update\" thrown in ruvnet/ruflo.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/mcp-tools/swarm-tools.ts:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}