earendil-works/pi · error · Error

Already compacted

Error message

Already compacted

What it means

Manual compaction was requested but the compaction preparation found the current turn/branch has already been compacted. Fires on redundant /compact invocations when there is nothing new to summarize.

Solutions

  1. Continue the conversation and compact again after new turns accumulate
  2. Navigate to an earlier branch point if you intended to compact older history
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/agent-session.ts:1885 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/70dd850d7eda3499. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/agent-session.ts:1885

		this._emit({ type: "compaction_start", reason: "manual" });
		let fromExtension = false;

		try {
			if (!this.model) {
				throw new Error(formatNoModelSelectedMessage());
			}

			const { model: requestModel, apiKey, headers, env } = await this._getSummarizationRequestAuth(this.model);

			const pathEntries = this.sessionManager.getBranch();
			const settings = this.settingsManager.getCompactionSettings();

			const preparation = prepareCompaction(pathEntries, settings);
			if (!preparation) {
				// Check why we can't compact
				const lastEntry = pathEntries[pathEntries.length - 1];
				if (lastEntry?.type === "compaction") {
					throw new Error("Already compacted");
				}
				throw new Error("Nothing to compact (session too small)");
			}

			let extensionCompaction: CompactionResult | undefined;

			if (this._extensionRunner.hasHandlers("session_before_compact")) {
				const result = (await this._extensionRunner.emit({
					type: "session_before_compact",
					preparation,
					branchEntries: pathEntries,
					customInstructions,
					reason: "manual",
					willRetry: false,
					signal: this._compactionAbortController.signal,
				})) as SessionBeforeCompactResult | undefined;

				if (result?.cancel) {

View on GitHub (pinned to 4af9d21d3b)