{"record":{"id":"c2a08a2af6d2bb7c","repo":"microsoft/vscode","slug":"stop-length","errorCode":"stop_length","errorMessage":"Length limit","messagePattern":"Length limit","errorType":"exception","errorClass":"CompletionsFetchError","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/prompts/node/codeMapper/codeMapper.ts","lineNumber":777,"sourceCode":"\t\tthis.telemetryService.sendMSFTTelemetryEvent('speculation.response.loop', {\n\t\t\tspeculationRequestId: result.requestId,\n\t\t\tlanguageId: isNewDocument(request) ? getLanguageForResource(uri).languageId : request.existingDocument.languageId,\n\t\t\tmodel,\n\t\t\thasLoop: String(hasLoop)\n\t\t}, {\n\t\t\tdocumentLength,\n\t\t\trewrittenLength: responseLength\n\t\t});\n\t}\n\n\tprivate ensureFinishReasonStopOrThrow(requestId: string, finishReason: Completion.FinishReason | undefined) {\n\t\tswitch (finishReason) {\n\t\t\tcase undefined:\n\t\t\t\tbreak;\n\t\t\tcase Completion.FinishReason.ContentFilter:\n\t\t\t\tthrow new CompletionsFetchError('stop_content_filter', requestId, 'Content filter');\n\t\t\tcase Completion.FinishReason.Length:\n\t\t\t\tthrow new CompletionsFetchError('stop_length', requestId, 'Length limit');\n\t\t\tcase Completion.FinishReason.Stop:\n\t\t\t\tbreak; // No error for 'Stop' finish reason\n\t\t\tdefault:\n\t\t\t\tassertNever(finishReason);\n\t\t}\n\t}\n\n\t//#endregion\n}\n\nfunction readLineByLine(source: AsyncIterable<string>, token: CancellationToken): AsyncIterable<LineOfText> {\n\treturn new AsyncIterableObject<LineOfText>(async (emitter) => {\n\t\tconst reader = new PartialAsyncTextReader(source[Symbol.asyncIterator]());\n\t\tlet previousLineWasEmpty = false; // avoid emitting a trailing empty line all the time\n\t\twhile (!reader.endOfStream) {\n\t\t\t// Skip everything until we hit a fence\n\t\t\tif (token.isCancellationRequested) {\n\t\t\t\tbreak;","sourceCodeStart":759,"sourceCodeEnd":795,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/prompts/node/codeMapper/codeMapper.ts#L759-L795","documentation":"Error \"Length limit\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/prompts/node/codeMapper/codeMapper.ts:777 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"a94b963a32aa9749d69504576791fa29700ae46d","analyzedAt":"2026-08-12T01:08:56.794Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}