{"record":{"id":"37707e2223efe93c","repo":"cline/cline","slug":"context-window-overflow-no-recovery-message","errorCode":null,"errorMessage":"CONTEXT_WINDOW_OVERFLOW_NO_RECOVERY_MESSAGE","messagePattern":"CONTEXT_WINDOW_OVERFLOW_NO_RECOVERY_MESSAGE","errorType":"exception","errorClass":"ContextWindowOverflowError","httpStatus":null,"severity":"error","filePath":"sdk/packages/agents/src/agent-runtime.ts","lineNumber":971,"sourceCode":"\n\t/**\n\t * Run a model turn, recovering once per run from a provider-rejected\n\t * context-window overflow: force a compaction through `prepareTurn` and\n\t * retry the request. Terminal (unrecoverable) overflow states throw with\n\t * an actionable message instead of the raw provider error.\n\t */\n\tprivate async generateAssistantMessageWithOverflowRecovery(): Promise<{\n\t\tmessage: AgentMessage;\n\t\tfinishReason: AgentModelFinishReason;\n\t}> {\n\t\tconst first = await this.generateAssistantMessage();\n\t\tif (!this.isRecoverableOverflowTurn(first)) {\n\t\t\treturn first;\n\t\t}\n\t\tthis.overflowRecoveryAttempted = true;\n\t\tconst providerError = this.state.lastError;\n\t\tif (!this.config.prepareTurn) {\n\t\t\tthrow new ContextWindowOverflowError(\n\t\t\t\tCONTEXT_WINDOW_OVERFLOW_NO_RECOVERY_MESSAGE,\n\t\t\t\tproviderError,\n\t\t\t);\n\t\t}\n\t\tawait this.emit({\n\t\t\ttype: \"status-notice\",\n\t\t\tsnapshot: this.snapshot(),\n\t\t\tmessage: \"context window exceeded — compacting and retrying\",\n\t\t\tmetadata: {\n\t\t\t\tkind: \"context_overflow_recovery\",\n\t\t\t\treason: \"context_overflow_recovery\",\n\t\t\t\tphase: \"started\",\n\t\t\t\titeration: this.state.iteration,\n\t\t\t\tproviderError,\n\t\t\t},\n\t\t});\n\t\tconst retry = await this.generateAssistantMessage({\n\t\t\toverflowRecovery: true,","sourceCodeStart":953,"sourceCodeEnd":989,"githubUrl":"https://github.com/cline/cline/blob/491b30b806fdb8c93513f821f2b87d63a61542f5/sdk/packages/agents/src/agent-runtime.ts#L953-L989","documentation":"Error \"CONTEXT_WINDOW_OVERFLOW_NO_RECOVERY_MESSAGE\" thrown in cline/cline.","triggerScenarios":"Thrown at sdk/packages/agents/src/agent-runtime.ts:971 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"491b30b806fdb8c93513f821f2b87d63a61542f5","analyzedAt":"2026-08-25T13:45:22.367Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}