{"record":{"id":"649f5480279d44fb","repo":"microsoft/vscode","slug":"invalidline","errorCode":"invalidLine","errorMessage":"Invalid Line: ${s}","messagePattern":"Invalid Line: (.+?)","errorType":"exception","errorClass":"InvalidPatchFormatError","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/tools/node/applyPatch/parser.ts","lineNumber":699,"sourceCode":"\t\t\t\tUPDATE_FILE_PREFIX,\n\t\t\t\tDELETE_FILE_PREFIX,\n\t\t\t\tADD_FILE_PREFIX,\n\t\t\t\tEND_OF_FILE_PREFIX,\n\t\t\t].some((p) => s.startsWith(p.trim()))\n\t\t) {\n\t\t\tif (mode === Mode.Keep && old.length && !/\\S/.test(old[old.length - 1])) {\n\t\t\t\t// @connor4312: If the last line is context and empty, remove it. Example\n\t\t\t\t// input adds an extra newline between `@@`-delimited sections which\n\t\t\t\t// cause matching to fail if preserved.\n\t\t\t\told.pop();\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (s === '***') {\n\t\t\tbreak;\n\t\t}\n\t\tif (s.startsWith('***')) {\n\t\t\tthrow new InvalidPatchFormatError(`Invalid Line: ${s}`, 'invalidLine');\n\t\t}\n\t\tindex += 1;\n\t\tconst lastMode: Mode = mode;\n\t\tlet line = s;\n\t\tif (line[0] === HUNK_ADD_LINE_PREFIX) {\n\t\t\tmode = Mode.Add;\n\t\t} else if (line[0] === HUNK_DELETE_LINE_PREFIX) {\n\t\t\tmode = Mode.Delete;\n\t\t} else if (line[0] === ' ') {\n\t\t\tmode = Mode.Keep;\n\t\t} else {\n\t\t\t// Tolerate invalid lines where the leading whitespace is missing. This is necessary as\n\t\t\t// the model sometimes doesn't fully adhere to the spec and returns lines without leading\n\t\t\t// whitespace for context lines.\n\t\t\tconst nextLine = lines[index];\n\t\t\tconst nextOp = nextLine?.[0] === HUNK_ADD_LINE_PREFIX ? Mode.Add : nextLine?.[0] === HUNK_DELETE_LINE_PREFIX ? Mode.Delete : Mode.Keep;\n\t\t\tconst canFuzz = mode !== Mode.Keep && nextOp === mode;\n","sourceCodeStart":681,"sourceCodeEnd":717,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/tools/node/applyPatch/parser.ts#L681-L717","documentation":"Error \"Invalid Line: ${s}\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:699 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"}