{"record":{"id":"327edbb14a3d684f","repo":"cline/cline","slug":"add-file-error-file-already-exists-path","errorCode":null,"errorMessage":"Add File Error: File already exists: ${path}","messagePattern":"Add File Error: File already exists: (.+?)","errorType":"validation","errorClass":"DiffError","httpStatus":null,"severity":"error","filePath":"sdk/packages/core/src/extensions/tools/executors/apply-patch-parser.ts","lineNumber":276,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\treturn action;\n\t}\n\n\tprivate parseDelete(path: string): void {\n\t\tthis.checkDuplicate(path, \"delete\");\n\t\tif (!(path in this.currentFiles)) {\n\t\t\tthrow new DiffError(`Delete File Error: Missing File: ${path}`);\n\t\t}\n\t\tthis.patch.actions[path] = { type: PatchActionType.DELETE, chunks: [] };\n\t\tthis.index++;\n\t}\n\n\tprivate parseAdd(path: string): void {\n\t\tthis.checkDuplicate(path, \"add\");\n\t\tif (path in this.currentFiles) {\n\t\t\tthrow new DiffError(`Add File Error: File already exists: ${path}`);\n\t\t}\n\n\t\tthis.index++;\n\t\tconst lines: string[] = [];\n\t\tconst stopMarkers = [\n\t\t\tPATCH_MARKERS.END,\n\t\t\tPATCH_MARKERS.UPDATE,\n\t\t\tPATCH_MARKERS.DELETE,\n\t\t\tPATCH_MARKERS.ADD,\n\t\t];\n\n\t\twhile (\n\t\t\tthis.hasMoreLines() &&\n\t\t\t!stopMarkers.some((marker) =>\n\t\t\t\tthis.lines[this.index]?.startsWith(marker.trim()),\n\t\t\t)\n\t\t) {\n\t\t\tconst line = this.lines[this.index++];","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/cline/cline/blob/491b30b806fdb8c93513f821f2b87d63a61542f5/sdk/packages/core/src/extensions/tools/executors/apply-patch-parser.ts#L258-L294","documentation":"Error \"Add File Error: File already exists: ${path}\" thrown in cline/cline.","triggerScenarios":"Thrown at sdk/packages/core/src/extensions/tools/executors/apply-patch-parser.ts:276 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"491b30b806fdb8c93513f821f2b87d63a61542f5","analyzedAt":"2026-08-25T13:45:22.367Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}