{"record":{"id":"397afb088bd513e4","repo":"deepseek-ai/deepseek-harness","slug":"file-already-exists-at-target-displaypath-can","errorCode":null,"errorMessage":"File already exists at: ${target.displayPath}. Cannot overwrite files using command `create`.","messagePattern":"File already exists at: (.+?)\\. Cannot overwrite files using command `create`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/fs/tool-str-replace-editor/src/index.ts","lineNumber":250,"sourceCode":"    throw new FsError(`cannot view \"${target.displayPath}\": not a regular file or directory`, 'FS_NOT_REGULAR_FILE')\n  }\n  const content = await ctx.fs.readText(target, exec.signal)\n  ctx.emit('fs/observed', target, { kind: 'present', version: info.version }, exec)\n  return formatFileView(target.displayPath, content, maxOutputChars, viewRange)\n}\n\nasync function createFile(\n  ctx: Context,\n  policy: MutationPolicy,\n  path: string,\n  fileText: string | undefined,\n  exec: ToolRunContext,\n): Promise<string> {\n  const content = requiredForCommand(fileText, 'file_text', 'create')\n  const sandboxPolicy = policy.resolve(exec)\n  const target = await resolveTarget(ctx, path, exec.signal)\n  if (await ctx.fs.stat(target, exec.signal) !== undefined) {\n    throw new Error(`File already exists at: ${target.displayPath}. Cannot overwrite files using command \\`create\\`.`)\n  }\n  const intent = await ctx.waterfall(\n    'fs/write-intent',\n    target,\n    exec,\n    () => ({ kind: 'createIfAbsent' } as const),\n  )\n  let outcome\n  try {\n    outcome = await ctx.fs.writeText(\n      target,\n      content,\n      intent,\n      exec.signal,\n      sandboxPolicy,\n    )\n  } catch (error: unknown) {\n    throw policy.mapError(error, sandboxPolicy)","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/fs/tool-str-replace-editor/src/index.ts#L232-L268","documentation":"Error \"File already exists at: ${target.displayPath}. Cannot overwrite files using command `create`.\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/fs/tool-str-replace-editor/src/index.ts:250 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":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}