microsoft/vscode · error · InvalidPatchFormatError
invalidAddFileLine
invalidAddFileLine
Error message
Invalid Add File Line: ${s} What it means
Error "Invalid Add File Line: ${s}" thrown in microsoft/vscode.
Source
Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:457
index = match.line + nextSection.nextChunkContext.length;
this.index = nextSection.endPatchIndex;
}
return action;
}
private parse_add_file(): PatchAction {
const lines: Array<string> = [];
while (
!this.is_done([
PATCH_SUFFIX,
UPDATE_FILE_PREFIX,
DELETE_FILE_PREFIX,
ADD_FILE_PREFIX,
])
) {
const s = this.read_str();
if (!s.startsWith(HUNK_ADD_LINE_PREFIX)) {
throw new InvalidPatchFormatError(`Invalid Add File Line: ${s}`, 'invalidAddFileLine');
}
lines.push(s.slice(1));
}
return {
type: ActionType.ADD,
newFile: lines.join('\n'),
chunks: [],
};
}
}
export function replace_explicit_tabs(s: string) {
return s.replace(/^(?:\s|\\t|\/|#)*/gm, r => r.replaceAll('\\t', '\t'));
}
export function replace_explicit_nl(s: string) {
return replace_explicit_tabs(s.replaceAll('\\n', '\n'));
}View on GitHub (pinned to a94b963a32)
When it happens
Trigger: Thrown at extensions/copilot/src/extension/tools/node/applyPatch/parser.ts:457 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/ab9cf7ff9a2eb9e9.
Report an issue: GitHub.