microsoft/vscode · error · Error
Unable to build prompt, modelMaxPromptTokens = ${maxTokens}
Error message
Unable to build prompt, modelMaxPromptTokens = ${maxTokens} (${e.message}) What it means
Error "Unable to build prompt, modelMaxPromptTokens = ${maxTokens} (${e.message})" thrown in microsoft/vscode.
Source
Thrown at extensions/copilot/src/extension/intents/node/agentIntent.ts:842
}
// Render the prompt without summarization or cache breakpoints, using
// the original endpoint (not reduced for tools/safety buffer).
const renderWithoutSummarization = async (reason: string, renderProps: AgentPromptProps = props): Promise<RenderPromptResult> => {
this.logService.debug(`[Agent] ${reason}, rendering without summarization`);
const renderer = PromptRenderer.create(this.instantiationService, this.endpoint, this.prompt, {
...renderProps,
endpoint: this.endpoint,
enableSummarization: false,
enableCacheBreakpoints: false
});
try {
return await renderer.render(progress, token);
} catch (e) {
if (e instanceof BudgetExceededError) {
this.logService.error(e, `[Agent] fallback render failed due to budget exceeded`);
const maxTokens = this.endpoint.modelMaxPromptTokens;
throw new Error(`Unable to build prompt, modelMaxPromptTokens = ${maxTokens} (${e.message})`);
}
throw e;
}
};
// Helper function for synchronous summarization flow with fallbacks
const renderWithSummarization = async (reason: string, renderProps: AgentPromptProps = props): Promise<RenderPromptResult> => {
// Check if a previous foreground summarization already failed in this
// turn. The metadata is set on the turn returned by getLatestTurn(),
// which is the same turn throughout a single buildPrompt call since
// the conversation doesn't advance mid-render.
const turn = promptContext.conversation?.getLatestTurn();
const previousForegroundSummary = turn?.getMetadata(SummarizedConversationHistoryMetadata);
if (previousForegroundSummary?.source === 'foreground' && previousForegroundSummary.outcome && previousForegroundSummary.outcome !== 'success') {
this.logService.debug(`[ConversationHistorySummarizer] ${reason}, skipping repeated foreground summarization after prior failure (${previousForegroundSummary.outcome})`);
/* __GDPR__
"triggerSummarizeSkipped" : {
"owner": "bhavyau",View on GitHub (pinned to a94b963a32)
When it happens
Trigger: Thrown at extensions/copilot/src/extension/intents/node/agentIntent.ts:842 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/vscode@a94b963a32 (2026-08-12).
Data as JSON: /api/errors/b1832fd24f393105.
Report an issue: GitHub.