{"record":{"id":"ab9cf7ff9a2eb9e9","repo":"microsoft/vscode","slug":"invalidaddfileline","errorCode":"invalidAddFileLine","errorMessage":"Invalid Add File Line: ${s}","messagePattern":"Invalid Add File Line: (.+?)","errorType":"exception","errorClass":"InvalidPatchFormatError","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/tools/node/applyPatch/parser.ts","lineNumber":457,"sourceCode":"\t\t\tindex = match.line + nextSection.nextChunkContext.length;\n\t\t\tthis.index = nextSection.endPatchIndex;\n\t\t}\n\t\treturn action;\n\t}\n\n\tprivate parse_add_file(): PatchAction {\n\t\tconst lines: Array<string> = [];\n\t\twhile (\n\t\t\t!this.is_done([\n\t\t\t\tPATCH_SUFFIX,\n\t\t\t\tUPDATE_FILE_PREFIX,\n\t\t\t\tDELETE_FILE_PREFIX,\n\t\t\t\tADD_FILE_PREFIX,\n\t\t\t])\n\t\t) {\n\t\t\tconst s = this.read_str();\n\t\t\tif (!s.startsWith(HUNK_ADD_LINE_PREFIX)) {\n\t\t\t\tthrow new InvalidPatchFormatError(`Invalid Add File Line: ${s}`, 'invalidAddFileLine');\n\t\t\t}\n\t\t\tlines.push(s.slice(1));\n\t\t}\n\t\treturn {\n\t\t\ttype: ActionType.ADD,\n\t\t\tnewFile: lines.join('\\n'),\n\t\t\tchunks: [],\n\t\t};\n\t}\n}\n\nexport function replace_explicit_tabs(s: string) {\n\treturn s.replace(/^(?:\\s|\\\\t|\\/|#)*/gm, r => r.replaceAll('\\\\t', '\\t'));\n}\n\nexport function replace_explicit_nl(s: string) {\n\treturn replace_explicit_tabs(s.replaceAll('\\\\n', '\\n'));\n}","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/tools/node/applyPatch/parser.ts#L439-L475","documentation":"Error \"Invalid Add File Line: ${s}\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:457 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"}