{"record":{"id":"b08b4499a4c4292b","repo":"parcel-bundler/parcel","slug":"enoent-b08b44","errorCode":"ENOENT","errorMessage":"does not exist","messagePattern":"does not exist","errorType":"error_code","errorClass":"FSError","httpStatus":null,"severity":"error","filePath":"packages/core/fs/src/OverlayFS.js","lineNumber":66,"sourceCode":"\n  serialize(): {|\n    $$raw: boolean,\n    readable: FileSystem,\n    writable: FileSystem,\n    deleted: Set<FilePath>,\n  |} {\n    return {\n      $$raw: false,\n      writable: this.writable,\n      readable: this.readable,\n      deleted: this.deleted,\n    };\n  }\n\n  _deletedThrows(filePath: FilePath): FilePath {\n    filePath = this._normalizePath(filePath);\n    if (this.deleted.has(filePath)) {\n      throw new FSError('ENOENT', filePath, 'does not exist');\n    }\n    return filePath;\n  }\n\n  _checkExists(filePath: FilePath): FilePath {\n    filePath = this._deletedThrows(filePath);\n    if (!this.existsSync(filePath)) {\n      throw new FSError('ENOENT', filePath, 'does not exist');\n    }\n    return filePath;\n  }\n\n  _isSymlink(filePath: FilePath): boolean {\n    filePath = this._normalizePath(filePath);\n    // Check the parts of the path to see if any are symlinks.\n    let {root, dir, base} = path.parse(filePath);\n    let segments = dir.slice(root.length).split(path.sep).concat(base);\n    while (segments.length) {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/fs/src/OverlayFS.js#L48-L84","documentation":"Thrown by OverlayFS._deletedThrows() when the given filePath is in the `deleted` Set. OverlayFS layers a writable filesystem on top of a readable one; when a file is deleted via the overlay, it's not removed from the readable layer but instead added to the `deleted` set to mask it. Any subsequent access throws ENOENT to honor the deletion.","triggerScenarios":"Calling any OverlayFS read/write/stat method that internally calls _deletedThrows on a path previously removed via `overlayFS.unlink()` or `overlayFS rimraf()`. The deleted Set persists for the lifetime of the OverlayFS instance.","commonSituations":"A Parcel build deletes a cached asset file, then a later stage (or re-run) tries to read it without clearing the deleted state. Hot-module replacement (HMR) logic deletes a file on change, then a stale reference tries to re-read it. Cache invalidation doesn't clear the deleted set, causing false ENOENT on files that still exist in the readable layer.","solutions":["Check `overlayFS.deleted.has(filePath)` before accessing a path that may have been deleted.","Use existsSync on the OverlayFS which accounts for the deleted set rather than checking the underlying readable layer directly.","If you need to restore a deleted file, create a new OverlayFS instance or remove the path from the deleted set programmatically."],"exampleFix":"// before\nlet content = await overlayFS.readFile(filePath); // throws if deleted\n\n// after\nif (!overlayFS.deleted.has(path.normalize(filePath))) {\n  let content = await overlayFS.readFile(filePath);\n}","handlingStrategy":"validation","validationCode":"// Check deleted set before accessing OverlayFS paths\nfunction isDeleted(overlayFS, filePath) {\n  const normalized = overlayFS._normalizePath(filePath);\n  return overlayFS.deleted.has(normalized);\n}\n\n// Usage:\nif (!isDeleted(overlayFS, filePath)) {\n  await overlayFS.readFile(filePath);\n}","typeGuard":"// Guard: check if the filesystem is an OverlayFS with a deleted Set\nfunction isOverlayFS(fs) {\n  return fs instanceof Object &&\n    fs.deleted instanceof Set &&\n    'writable' in fs &&\n    'readable' in fs;\n}","tryCatchPattern":"try {\n  await overlayFS.readFile(filePath);\n} catch (e) {\n  if (e.code === 'ENOENT' && overlayFS.deleted.has(overlayFS._normalizePath(filePath))) {\n    // File was logically deleted — recreate or skip\n  } else {\n    throw e;\n  }\n}","preventionTips":["Track which files your code deletes and avoid accessing them without restoring.","Use existsSync on the OverlayFS (which respects the deleted set) rather than checking the readable layer directly.","When implementing cache invalidation, consider recreating the OverlayFS or clearing the deleted set to avoid stale deletion state."],"tags":["filesystem","overlayfs","enoent","deleted-state","virtual-files"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}