deepseek-ai/deepseek-harness · error · FsError
FS_AMBIGUOUS_EDIT
FS_AMBIGUOUS_EDIT
Error message
No replacement was performed. Multiple occurrences of old_str `${oldValue}` in lines [${lines.join(', ')}]. Please ensure it is unique What it means
Error "No replacement was performed. Multiple occurrences of old_str `${oldValue}` in lines [${lines.join(', ')}]. Please ensure it is unique" thrown in deepseek-ai/deepseek-harness.
Source
Thrown at packages/fs/tool-str-replace-editor/src/index.ts:302
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 }
: { kind: 'replaceIfVersion', version: intent.version },
exec.signal,
sandboxPolicy,
)
} catch (error: unknown) {
throw policy.mapError(error, sandboxPolicy)
}View on GitHub (pinned to b150a551b8)
When it happens
Trigger: Thrown at packages/fs/tool-str-replace-editor/src/index.ts:302 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/defaf04a8c2dbc09.
Report an issue: GitHub.