deepseek-ai/deepseek-harness · error · FsError

FS_EDIT_NOT_FOUND

FS_EDIT_NOT_FOUND

Error message

No replacement was performed, old_str `${oldValue}` did not appear verbatim in ${target.displayPath}.

What it means

Error "No replacement was performed, old_str `${oldValue}` did not appear verbatim in ${target.displayPath}." thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/fs/tool-str-replace-editor/src/index.ts:295

  path: string,
  oldStr: string | undefined,
  newStr: string | undefined,
  exec: ToolRunContext,
): Promise<string> {
  const sandboxPolicy = policy.resolve(exec)
  const target = await resolveTarget(ctx, path, exec.signal)
  const intent = await ctx.waterfall('fs/edit-intent', target, exec, () => undefined)
  const oldValue = requiredForCommand(oldStr, 'old_str', 'str_replace', false)
  const newValue = newStr ?? ''
  const info = await statExisting(ctx, target, 'str_replace', exec)
  if (info.type !== 'file') {
    throw new FsError(`cannot edit "${target.displayPath}": not a regular file`, 'FS_NOT_REGULAR_FILE')
  }
  const before = await ctx.fs.readText(target, exec.signal)
  const offsets = matchOffsets(before, oldValue)
  const offset = offsets[0]
  if (offset === undefined) {
    throw new FsError(
      `No replacement was performed, old_str \`${oldValue}\` did not appear verbatim in ${target.displayPath}.`,
      'FS_EDIT_NOT_FOUND',
    )
  }
  if (offsets.length > 1) {
    const lines = lineNumbersAt(before, offsets)
    throw new FsError(
      `No replacement was performed. Multiple occurrences of old_str \`${oldValue}\` in lines [${lines.join(', ')}]. Please ensure it is unique`,
      'FS_AMBIGUOUS_EDIT',
    )
  }
  let outcome
  try {
    outcome = await ctx.fs.writeText(
      target,
      before.slice(0, offset) + newValue + before.slice(offset + oldValue.length),
      intent === undefined
        ? { kind: 'replaceIfVersion', version: info.version }

View on GitHub (pinned to b150a551b8)

When it happens

Trigger: Thrown at packages/fs/tool-str-replace-editor/src/index.ts:295 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/a7fd940ab5c1e189. Report an issue: GitHub.