{"record":{"id":"72a26e8065ea4e25","repo":"deepseek-ai/deepseek-harness","slug":"context-overflow-compaction-failed-message","errorCode":null,"errorMessage":"context-overflow compaction failed: ${message}; ${signal.aborted ? 'cancellation prevents retry' : 'preserving the original request error'}","messagePattern":"context-overflow compaction failed: (.+?); (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/compaction/compaction-basic/src/index.ts","lineNumber":209,"sourceCode":"      const generation = agent.session.surface.replaceGeneration\n      let result: CompactionResult | null\n      try {\n        result = await this.compactIfNeeded(agent, 'context-overflow', signal)\n      } catch (recoveryError: unknown) {\n        const message = recoveryError instanceof Error ? recoveryError.message : String(recoveryError)\n        // A model-free prune can land before later summary work fails. That\n        // durable reduction is sufficient retry proof; do not discard it just\n        // because the optional second phase threw. Cancellation still wins.\n        // oxlint-disable-next-line typescript/no-unnecessary-condition -- the signal can abort while recovery is awaited.\n        if (!signal.aborted && agent.session.surface.replaceGeneration > generation) {\n          ctx.logger.warn(\n            `context-overflow compaction failed after durable surface progress: ${message}; `\n            + 'retrying from the replacement surface',\n          )\n          this.overflowRetries.set(agent, retries + 1)\n          return { kind: 'retry' }\n        }\n        ctx.logger.warn(\n          // oxlint-disable-next-line typescript/no-unnecessary-condition -- the signal can abort while recovery is awaited.\n          `context-overflow compaction failed: ${message}; ${signal.aborted\n            ? 'cancellation prevents retry'\n            : 'preserving the original request error'}`,\n        )\n        return next()\n      }\n      // oxlint-disable-next-line typescript/no-unnecessary-condition -- the signal can abort while compaction is awaited.\n      if (signal.aborted\n        || agent.session.surface.replaceGeneration <= generation) return next()\n      if (result !== null) logResult(result, 'context overflow recovery')\n      this.overflowRetries.set(agent, retries + 1)\n      return { kind: 'retry' }\n    })\n  }\n\n  /**\n   * Summarize the replayed conversation region through a direct one-shot","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/compaction/compaction-basic/src/index.ts#L191-L227","documentation":"Error \"context-overflow compaction failed: ${message}; ${signal.aborted ? 'cancellation prevents retry' : 'preserving the original request error'}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/compaction/compaction-basic/src/index.ts:209 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the request context size manually or start a new session; check the underlying provider error message."],"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"}