{"record":{"id":"cdf4fe91535ef9be","repo":"peass-ng/PEASS-ng","slug":"error-not-a-reparse-point","errorCode":"ERROR_NOT_A_REPARSE_POINT","errorMessage":"The directory is not a mount point: [{0}]","messagePattern":"The directory is not a mount point: \\[(.+?)\\]","errorType":"exception","errorClass":"NotAReparsePointException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory Core Methods/Directory.DeleteJunctionCore.cs","lineNumber":65,"sourceCode":"      [SecurityCritical]\n      internal static void DeleteJunctionCore(KernelTransaction transaction, FileSystemEntryInfo fsEntryInfo, string junctionPath, bool removeDirectory, PathFormat pathFormat)\n      {\n         if (null == fsEntryInfo)\n         {\n            if (pathFormat != PathFormat.LongFullPath)\n            {\n               Path.CheckSupportedPathFormat(junctionPath, true, true);\n\n               junctionPath = Path.GetExtendedLengthPathCore(transaction, junctionPath, pathFormat, GetFullPathOptions.CheckInvalidPathChars | GetFullPathOptions.RemoveTrailingDirectorySeparator);\n\n               pathFormat = PathFormat.LongFullPath;\n            }\n\n\n            fsEntryInfo = File.GetFileSystemEntryInfoCore(transaction, true, junctionPath, false, pathFormat);\n\n            if (!fsEntryInfo.IsMountPoint)\n               throw new NotAReparsePointException(string.Format(CultureInfo.InvariantCulture, Resources.Directory_Is_Not_A_MountPoint, fsEntryInfo.LongFullPath), (int) Win32Errors.ERROR_NOT_A_REPARSE_POINT);\n         }\n         \n\n         pathFormat = PathFormat.LongFullPath;\n\n\n         // Remove the directory junction.\n\n         using (var safeHandle = OpenDirectoryJunction(transaction, fsEntryInfo.LongFullPath, pathFormat))\n\n            Device.DeleteDirectoryJunction(safeHandle);\n\n\n         // Optionally the folder itself, which should and must be empty.\n\n         if (removeDirectory)\n\n            DeleteDirectoryCore(transaction, fsEntryInfo, null, false, false, true, pathFormat);","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory Core Methods/Directory.DeleteJunctionCore.cs#L47-L83","documentation":"DeleteJunctionCore throws NotAReparsePointException with message 'The directory is not a mount point: [{0}]' and underlying Win32 error ERROR_NOT_A_REPARSE_POINT when the given junctionPath exists but is a plain directory without a mount-point/junction reparse tag. Only reparse points of type mount point can be deleted as junctions, so AlphaFS validates fsEntryInfo.IsMountPoint before issuing the native removal.","triggerScenarios":"Calling Directory.DeleteJunction / DeleteJunctionTransacted on a normal (non-reparse) directory; passing a symbolic link instead of a junction (symlinks have a different reparse tag); passing the junction's TARGET path rather than the junction path itself.","commonSituations":"Confusing junctions and symbolic links in Windows (mklink /J vs mklink /D); cleanup scripts that blindly call DeleteJunction on every directory in a tree; path typos pointing to the real folder behind the junction.","solutions":["Verify the path is a junction first with Directory.IsMountPoint (or GetLinkTargetInfo) before calling DeleteJunction.","Use Directory.Delete on regular directories and reserve DeleteJunction for actual mount points.","Distinguish reparse tag: check attributes for FILE_ATTRIBUTE_REPARSE_POINT and the mount-point tag.","If the intent was to remove a symlink, use the appropriate symlink-removal API instead."],"exampleFix":"// before\nDirectory.DeleteJunction(path); // fails if path is a normal dir or symlink\n// after\nif (Directory.Exists(path) && Directory.IsMountPoint(path))\n    Directory.DeleteJunction(path);\nelse\n    Directory.Delete(path, true); // handle normal directories separately","handlingStrategy":"validation","validationCode":"if (!Directory.IsMountPoint(path))\n    throw new InvalidOperationException($\"{path} is not a junction/mount point\");","typeGuard":"bool IsJunction(string p) => Directory.Exists(p) && Directory.IsMountPoint(p);","tryCatchPattern":"try { Directory.DeleteJunction(path); }\ncatch (NotAReparsePointException) { Directory.Delete(path, true); }","preventionTips":["Use DeleteJunction only on paths created via CreateJunction or mklink /J","Distinguish junctions from symlinks (different reparse tags)","Never call DeleteJunction on the junction's target directory","Validate reparse-point attributes before link-removal calls"],"tags":["windows","junction","reparse-point","wrong-item-type"],"backgroundTag":"not-a-reparse-point","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}