{"record":{"id":"c33b95aa9ab2b87e","repo":"deepseek-ai/deepseek-harness","slug":"mcp-client-servername-config-servername-is-a","errorCode":null,"errorMessage":"mcp-client: serverName \"${config.serverName}\" is already in use by another mcp-client instance — pick a unique serverName in cordis.yml","messagePattern":"mcp-client: serverName \"(.+?)\" is already in use by another mcp-client instance — pick a unique serverName in cordis\\.yml","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mcp/mcp-client/src/index.ts","lineNumber":155,"sourceCode":" * @param config - resolved transport and server namespace configuration.\n * @returns startup readiness after connection and initial tool discovery settle.\n */\nexport async function apply(ctx: Context, config: Config): Promise<void> {\n  // Fail loud at load: reconnect misconfiguration (including programmatic\n  // construction that bypassed Schemastery) rejects THIS instance before any\n  // effect registers.\n  const reconnect = resolveReconnectPolicy(config.reconnect, `mcp-client(${config.serverName}): reconnect`)\n\n  // Reserve the namespace next: a duplicate `serverName` fails THIS instance\n  // at load with an actionable error and leaves the earlier instance intact.\n  ctx.effect(() => {\n    let names = activeServerNames.get(ctx.root)\n    if (!names) {\n      names = new Set()\n      activeServerNames.set(ctx.root, names)\n    }\n    if (names.has(config.serverName)) {\n      throw new Error(\n        `mcp-client: serverName \"${config.serverName}\" is already in use by another mcp-client instance — pick a unique serverName in cordis.yml`,\n      )\n    }\n    names.add(config.serverName)\n    return () => void names.delete(config.serverName)\n  }, 'mcp-client.serverName')\n\n  // The supervisor owns the client/transport generations, the reconnect\n  // loop, and the live tool registrations; disposal stops reconnection,\n  // quiesces in-flight work, and unregisters the current generation.\n  const connection = startConnection(ctx, config, reconnect)\n\n  ctx.effect(() => {\n    return () => connection.dispose()\n  }, 'mcp-client.connection')\n\n  // Block plugin activation on the initial connection + tool discovery so\n  // Cordis consumers observe the tools immediately after the fiber activates.","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/mcp/mcp-client/src/index.ts#L137-L173","documentation":"Error \"mcp-client: serverName \"${config.serverName}\" is already in use by another mcp-client instance — pick a unique serverName in cordis.yml\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/mcp/mcp-client/src/index.ts:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pick a unique serverName in cordis.yml for each mcp-client instance."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}