cline/cline · error · DiffError

Add File Error: File already exists: ${path}

Error message

Add File Error: File already exists: ${path}

What it means

Error "Add File Error: File already exists: ${path}" thrown in cline/cline.

Source

Thrown at sdk/packages/core/src/extensions/tools/executors/apply-patch-parser.ts:276

			}
		}

		return action;
	}

	private parseDelete(path: string): void {
		this.checkDuplicate(path, "delete");
		if (!(path in this.currentFiles)) {
			throw new DiffError(`Delete File Error: Missing File: ${path}`);
		}
		this.patch.actions[path] = { type: PatchActionType.DELETE, chunks: [] };
		this.index++;
	}

	private parseAdd(path: string): void {
		this.checkDuplicate(path, "add");
		if (path in this.currentFiles) {
			throw new DiffError(`Add File Error: File already exists: ${path}`);
		}

		this.index++;
		const lines: string[] = [];
		const stopMarkers = [
			PATCH_MARKERS.END,
			PATCH_MARKERS.UPDATE,
			PATCH_MARKERS.DELETE,
			PATCH_MARKERS.ADD,
		];

		while (
			this.hasMoreLines() &&
			!stopMarkers.some((marker) =>
				this.lines[this.index]?.startsWith(marker.trim()),
			)
		) {
			const line = this.lines[this.index++];

View on GitHub (pinned to 491b30b806)

When it happens

Trigger: Thrown at sdk/packages/core/src/extensions/tools/executors/apply-patch-parser.ts:276 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cline/cline@491b30b806 (2026-08-25). Data as JSON: /api/errors/327edbb14a3d684f. Report an issue: GitHub.