{"record":{"id":"50cf02650e6ba521","repo":"deepseek-ai/deepseek-harness","slug":"acp-agent-teardown-failed-for-failures-length-s","errorCode":null,"errorMessage":"ACP agent teardown failed for ${failures.length} session(s): ${detail}","messagePattern":"ACP agent teardown failed for (.+?) session\\(s\\): (.+?)","errorType":"exception","errorClass":"AggregateError","httpStatus":null,"severity":"error","filePath":"packages/acp/acp/src/index.ts","lineNumber":503,"sourceCode":"      const subagents = ctx.get('subagents') as ContinuableDrain | undefined\n      if (subagents !== undefined) {\n        try {\n          await subagents.drainContinuableDescendants(records.map(record => record.agent))\n        } catch (error: unknown) {\n          logger.warn(`acp: continuable subagent teardown failed: ${String(error)}`)\n        }\n      }\n      const disposals = await Promise.allSettled(records.map(record => record.dispose()))\n      const failures: unknown[] = []\n      for (const result of disposals) {\n        if (result.status === 'rejected') failures.push(result.reason as unknown)\n      }\n      if (failures.length > 0) {\n        // The production consumer logs this AggregateError through `String`,\n        // which renders only its message. Embed every per-session diagnostic,\n        // including nested causes and aggregate members, in that message.\n        const detail = failures.map(failure => errorChain(failure)).join('; ')\n        throw new AggregateError(\n          failures,\n          `ACP agent teardown failed for ${failures.length} session(s): ${detail}`,\n        )\n      }\n    })()\n    return quiescing\n  }\n\n  /* v8 ignore start -- production transport rejection and teardown failure. */\n  void conn.closed\n    .catch((error: unknown) => {\n      logger.warn(`acp: connection closed with an error: ${String(error)}`)\n    })\n    .then(quiesce)\n    .catch((error: unknown) => {\n      logger.warn(`acp: connection-close teardown failed: ${String(error)}`)\n    })\n  /* v8 ignore stop */","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/acp/acp/src/index.ts#L485-L521","documentation":"Error \"ACP agent teardown failed for ${failures.length} session(s): ${detail}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/acp/acp/src/index.ts:503 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the per-session failure detail, fix each failing session teardown, and retry closing the ACP agent."],"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"}