From 23016fdfa5449f4537f113a076ede22ad0c5c19e Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 6 May 2026 16:53:30 -0400 Subject: [PATCH] fix(hive-mind): use --mcp-config= to stop variadic prompt slurp (#1780) (#1800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude Code's `--mcp-config ` flag is variadic, so passing it as two argv tokens lets a later positional argument — the hive-mind prompt itself — get slurped as a second config file path. Once the prompt grows past PATH_MAX (4000+ chars is normal for hive-mind), `open(prompt)` fails with `ENAMETOOLONG: name too long`, the worker never spawns, and `ruflo hive-mind spawn --claude` exits 1. Use `=`-syntax (`--mcp-config=`) so the flag stays attached to its single value and the prompt is parsed as the prompt. Closes #1780. --- v3/@claude-flow/cli/src/commands/hive-mind.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/v3/@claude-flow/cli/src/commands/hive-mind.ts b/v3/@claude-flow/cli/src/commands/hive-mind.ts index 40cf625241..cc8bdedaa1 100644 --- a/v3/@claude-flow/cli/src/commands/hive-mind.ts +++ b/v3/@claude-flow/cli/src/commands/hive-mind.ts @@ -274,7 +274,12 @@ async function spawnClaudeCodeInstance( } } if (mcpConfigPath) { - claudeArgs.push('--mcp-config', mcpConfigPath); + // #1780 — Claude Code's `--mcp-config` is variadic; passing it as two + // argv tokens (`--mcp-config`, ``) lets a later positional (the + // hive-mind prompt) be slurped as a second config file, producing + // `ENAMETOOLONG: name too long, open` once the prompt exceeds PATH_MAX. + // Use `=`-syntax so the flag stays attached to its single value. + claudeArgs.push(`--mcp-config=${mcpConfigPath}`); output.printInfo(`Spawned worker MCP config: ${mcpConfigPath}`); } else { output.printWarning('No .mcp.json or ~/.claude.json found — spawned worker will not have mcp__ruflo__* tools (#1748 Issue 2). Pass --mcp-config or run "ruflo init" to generate one.');