{"record":{"id":"2990a5e0bc57a8f2","repo":"deepseek-ai/deepseek-harness","slug":"fs-edit-not-found","errorCode":"FS_EDIT_NOT_FOUND","errorMessage":"cannot edit \"${displayPath}\": old_string must be non-empty","messagePattern":"cannot edit \"(.+?)\": old_string must be non-empty","errorType":"exception","errorClass":"FsError","httpStatus":null,"severity":"error","filePath":"packages/e2b/fs-e2b/src/index.ts","lineNumber":153,"sourceCode":"function mapError(error: unknown, operation: string, displayPath: string, signal?: AbortSignal): FsError {\n  if (error instanceof FsError) return error\n  if (signal?.aborted === true || (error instanceof DOMException && error.name === 'AbortError')) {\n    return new FsError(`${operation} aborted`, 'FS_ABORTED', { cause: error })\n  }\n  if (error instanceof FileNotFoundError) {\n    return new FsError(`cannot ${operation} \"${displayPath}\": not found`, 'FS_NOT_FOUND', { cause: error })\n  }\n  if (/permission denied|operation not permitted/i.test(String(error))) {\n    return new FsError(`cannot ${operation} \"${displayPath}\": permission denied`, 'FS_PERMISSION_DENIED', { cause: error })\n  }\n  return new FsError(`cannot ${operation} \"${displayPath}\": ${String(error)}`, 'FS_IO_ERROR', { cause: error })\n}\n\nfunction literalEdit(content: string, request: FsEditRequest, displayPath: string): string {\n  const oldString = normalizeLineEndings(request.oldString)\n  const newString = normalizeLineEndings(request.newString)\n  if (oldString.length === 0) {\n    throw new FsError(`cannot edit \"${displayPath}\": old_string must be non-empty`, 'FS_EDIT_NOT_FOUND')\n  }\n  let matches = 0\n  let offset = 0\n  while (true) {\n    const found = content.indexOf(oldString, offset)\n    if (found < 0) break\n    matches += 1\n    offset = found + oldString.length\n  }\n  if (matches === 0) throw new FsError(`cannot edit \"${displayPath}\": old_string was not found`, 'FS_EDIT_NOT_FOUND')\n  if (!request.replaceAll && matches !== 1) {\n    throw new FsError(`cannot edit \"${displayPath}\": old_string matched ${matches} times`, 'FS_AMBIGUOUS_EDIT')\n  }\n  return request.replaceAll ? content.split(oldString).join(newString) : content.replace(oldString, newString)\n}\n\n/** Remote filesystem backend sharing the sandbox owned by `ctx.e2b`. */\nexport class E2BFileSystem extends FileSystem {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/e2b/fs-e2b/src/index.ts#L135-L171","documentation":"Error \"cannot edit \"${displayPath}\": old_string must be non-empty\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/e2b/fs-e2b/src/index.ts:153 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"}