deepseek-ai/deepseek-harness · error · Error
summary is not smaller than the shadowed content (${framedSu
Error message
summary is not smaller than the shadowed content (${framedSummaryTokenCount} estimated framed tokens >= ${prepared.shadowedTokenCount}) What it means
After the summarizer returns, the replacement checkpoint user message (preamble plus <compacted-summary> framing plus the summary) is priced with the token meter. If its estimated framed tokens are greater than or equal to the shadowed span's tokens, the compaction would not free context, so the transaction rejects it. On a manual compactNow this surfaces wrapped in ManualCompactionError code 'summary' with this error as the cause.
Source
Thrown at packages/compaction/compaction-basic/src/region.ts:375
}
/** Run the summarizer and frame its replacement checkpoint. */
async function summarizeCompaction(
dependencies: RegionDependencies,
prepared: PreparedCompaction,
agent: Agent,
compactionId: CompactionResult['compactionId'],
sourceCommandId: CommandId | undefined,
signal?: AbortSignal,
): Promise<SummarizedCompaction> {
const summaryResult = await dependencies.summarize(prepared.input, agent, signal)
const checkpointMessage = createUserMessage({
content: frameSummary(summaryResult.summary),
source: compactCheckpointSource(compactionId, sourceCommandId),
})
const framedSummaryTokenCount = dependencies.meter.estimateMessage(checkpointMessage)
if (framedSummaryTokenCount >= prepared.shadowedTokenCount) {
throw new Error(
`summary is not smaller than the shadowed content (${framedSummaryTokenCount} estimated framed tokens >= ${prepared.shadowedTokenCount})`,
)
}
return {
...prepared,
...summaryResult,
checkpointMessage,
}
}
/** Reject a summary prepared against any earlier surface generation. */
function assertWholeSurfaceUnchanged(
dependencies: RegionDependencies,
session: Session,
prepared: PreparedCompaction,
): void {
const current = dependencies.meter.measure(session)
if (!isDeepStrictEqual(current.nodes, prepared.measurement.nodes)) {View on GitHub (pinned to b150a551b8)
Solutions
- Widen the compacted range so the shadowed token count clearly exceeds summary-plus-framing size
- Route summarization to a more concise model via summarizationProvider/summarizationModel
- For manual idle compaction, prefer compactNow — it selects a maximal useful range instead of a caller-chosen span
- On automatic pressure, lower retainRatio or retainTokens so more head history is compactable
Example fix
// before: 3-node span — framing alone can rival it await ctx.compaction.compactRegion(nodes[0]!, nodes[2]!, agent) // after: include enough history that a summary can be strictly smaller await ctx.compaction.compactRegion(nodes[0]!, balancedEndMuchFartherOut, agent)
Defensive patterns
Strategy: try-catch
Type guard
const isShrinkFailure = (error: unknown): error is Error =>
error instanceof Error && error.message.startsWith('summary is not smaller than the shadowed content') Try / catch
try {
return await ctx.compaction.compactRegion(start, end, agent, signal)
} catch (error) {
if (isShrinkFailure(error) && canWiden(end)) {
// widen once to a farther balanced end and retry
return await ctx.compaction.compactRegion(start, widerBalancedEnd(end), agent, signal)
}
throw error
} Prevention
- Never compact spans only a few nodes long — checkpoint framing is a fixed cost the summary must beat
- Route summarization to a concise model so output stays well under the shadowed size
- For idle compaction use compactNow, which selects a maximal useful range for you
When it happens
Trigger: Compacting a very short span where the fixed framing overhead rivals the shadowed content; a verbose summarization model that restates the transcript; re-compacting a span that is already mostly one prior checkpoint merged forward near-verbatim.
Common situations: Manual compactRegion on a two- or three-node span; summarization routed to an over-detailed model; repeated compaction cycles over short histories.
Related errors
- summary
- summarization produced no text summary content
- BasicCompactionConfig: auto must be a boolean
- BasicCompactionConfig: contextWindow (${contextWindow}) must
- BasicCompactionConfig: ${policy.target.provider}/${policy.ta
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/24cdbcfc9337566c.
Report an issue: GitHub.