earendil-works/pi · error · Error

Summarization attempted to call a tool

Error message

Summarization attempted to call a tool

What it means

Guard in generateSummaryWithUsage: the summarization response contained toolCall blocks, but the summarization request sends no tools — the model attempted a tool call against a tool-less context, which the compactor treats as invalid output.

Solutions

  1. Retry with a different model that follows the no-tool instruction
  2. Report a bug if the model reproducibly emits tool calls for summarization
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/core/compaction/compaction.ts:706 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/f84569fece89680f. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/compaction/compaction.ts:706

		signal,
		thinkingLevel,
		sessionId,
	);

	const response = await completeSummarization(
		model,
		buildSummarizationContext(promptText),
		completionOptions,
		streamFn,
		retry,
		callbacks,
	);

	if (response.stopReason === "error") {
		throw new Error(`Summarization failed: ${response.errorMessage || "Unknown error"}`);
	}
	if (response.content.some((block) => block.type === "toolCall")) {
		throw new Error("Summarization attempted to call a tool");
	}

	const textContent = contentText(response.content);

	return { text: textContent, usage: response.usage };
}

// ============================================================================
// Compaction Preparation (for extensions)
// ============================================================================

export interface CompactionPreparation {
	/** UUID of first entry to keep */
	firstKeptEntryId: string;
	/** Messages that will be summarized and discarded */
	messagesToSummarize: AgentMessage[];
	/** Messages that will be turned into turn prefix summary (if splitting) */
	turnPrefixMessages: AgentMessage[];

View on GitHub (pinned to 4af9d21d3b)