cline/cline · error · DiffError
Cannot create ${filePath} with no content
Error message
Cannot create ${filePath} with no content What it means
Error "Cannot create ${filePath} with no content" thrown in cline/cline.
Source
Thrown at sdk/packages/core/src/extensions/tools/executors/apply-patch.ts:293
async function applyChanges(
changes: Record<string, PatchFileChange>,
cwd: string,
encoding: BufferEncoding,
restrictToCwd: boolean,
): Promise<string[]> {
const touched: string[] = [];
for (const [filePath, change] of Object.entries(changes)) {
const sourceAbsPath = resolveFilePath(cwd, filePath, restrictToCwd);
switch (change.type) {
case PatchActionType.DELETE:
await fs.rm(sourceAbsPath, { force: true });
touched.push(`${filePath}: [deleted]`);
break;
case PatchActionType.ADD:
if (change.newContent === undefined) {
throw new DiffError(`Cannot create ${filePath} with no content`);
}
await fs.mkdir(path.dirname(sourceAbsPath), { recursive: true });
await fs.writeFile(sourceAbsPath, change.newContent, { encoding });
touched.push(filePath);
break;
case PatchActionType.UPDATE: {
if (change.newContent === undefined) {
throw new DiffError(
`UPDATE change for ${filePath} has no new content`,
);
}
if (change.movePath) {
const moveAbsPath = resolveFilePath(
cwd,
change.movePath,
restrictToCwd,
);View on GitHub (pinned to 491b30b806)
When it happens
Trigger: Thrown at sdk/packages/core/src/extensions/tools/executors/apply-patch.ts:293 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/d9591eb9f950dade.
Report an issue: GitHub.