{"record":{"id":"157c533dac975100","repo":"deepseek-ai/deepseek-harness","slug":"fs-edit-not-found-157c53","errorCode":"FS_EDIT_NOT_FOUND","errorMessage":"old_string must be a non-empty string","messagePattern":"old_string must be a non-empty string","errorType":"exception","errorClass":"FsError","httpStatus":null,"severity":"error","filePath":"packages/fs/fs-local/src/fsio.ts","lineNumber":768,"sourceCode":" * `FS_EDIT_NOT_FOUND`; multiple matches throw `FS_AMBIGUOUS_EDIT` unless `replaceAll` is true.\n * @param content - the current file content, already LF-normalized.\n * @param oldString - literal text to find; CRLF inside it is normalized to LF before\n *   matching.\n * @param newString - literal replacement text, normalized the same way.\n * @param replaceAll - replace every match instead of requiring exactly one.\n * @param displayPath - the caller-facing path used in error messages.\n * @returns the edited LF-normalized content plus how many occurrences were replaced.\n */\nexport function applyLiteralEdit(\n  content: string,\n  oldString: string,\n  newString: string,\n  replaceAll: boolean,\n  displayPath: string,\n): { content: string; replacements: number } {\n  const oldNorm = normalizeLineEndings(oldString)\n  if (oldNorm.length === 0) {\n    throw new FsError('old_string must be a non-empty string', 'FS_EDIT_NOT_FOUND')\n  }\n  const newNorm = normalizeLineEndings(newString)\n  const replacements = countOccurrences(content, oldNorm)\n  if (replacements === 0) {\n    throw new FsError(`old_string was not found in \"${displayPath}\"`, 'FS_EDIT_NOT_FOUND')\n  }\n  if (!replaceAll && replacements > 1) {\n    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')\n  }\n  return { content: content.split(oldNorm).join(newNorm), replacements }\n}\n\nexport { normalizeLineEndings, restoreLineEndings }\n","sourceCodeStart":750,"sourceCodeEnd":782,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/fs/fs-local/src/fsio.ts#L750-L782","documentation":"Error \"old_string must be a non-empty string\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/fs/fs-local/src/fsio.ts:768 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"}