deepseek-ai/deepseek-harness · error · FsError

FS_AMBIGUOUS_EDIT

FS_AMBIGUOUS_EDIT

Error message

old_string matched ${replacements} times in "${displayPath}"; provide a more specific old_string or set replace_all to true

What it means

Error "old_string matched ${replacements} times in "${displayPath}"; provide a more specific old_string or set replace_all to true" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/fs/fs-local/src/fsio.ts:776

 */
export function applyLiteralEdit(
  content: string,
  oldString: string,
  newString: string,
  replaceAll: boolean,
  displayPath: string,
): { content: string; replacements: number } {
  const oldNorm = normalizeLineEndings(oldString)
  if (oldNorm.length === 0) {
    throw new FsError('old_string must be a non-empty string', 'FS_EDIT_NOT_FOUND')
  }
  const newNorm = normalizeLineEndings(newString)
  const replacements = countOccurrences(content, oldNorm)
  if (replacements === 0) {
    throw new FsError(`old_string was not found in "${displayPath}"`, 'FS_EDIT_NOT_FOUND')
  }
  if (!replaceAll && replacements > 1) {
    throw new FsError(`old_string matched ${replacements} times in "${displayPath}"; provide a more specific old_string or set replace_all to true`, 'FS_AMBIGUOUS_EDIT')
  }
  return { content: content.split(oldNorm).join(newNorm), replacements }
}

export { normalizeLineEndings, restoreLineEndings }

View on GitHub (pinned to b150a551b8)

When it happens

Trigger: Thrown at packages/fs/fs-local/src/fsio.ts:776 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/bc1fb31dfe1b3453. Report an issue: GitHub.