Unable to delete a page that is not accessible (URL)

Hey,
Thanks for this piece of code.

I tried the velocity script but the pages still show up in bread crumbs/navigation but not in my list from my snippet above. I think that might be an important distinction since otherwise that code seems to list every other page and their children properly that are on that sub-wiki.

I’ve tested the script on other test pages I created for this purpose in the same space as the problematic one and I seem to have no issues having the velocity script delete those.

I added one line to see if the doc exists (calling $xwiki.exists() ). It seems my (newly created for deletion purposes) do exist before deletion and after a refresh do not (as expected).
Unfortunately, the pages I am trying to delete while they do show up in bread crumbs/navigation, they do not show up in my listing of all pages/their children and also do not seem to exist according to that call. But they do on that path when I try to create one there (as seen in the screenshot of my first post).

Kinda at a loss now. This seems to point that the expected path is not the one stored inside the database/XWiki.

Sincerely,

P.-S.: For reference/completeness, here is the modified snippet:

{{velocity}}
 #set($document = $xwiki.getDocument('Servo Erector Set (SES) Building System.SES V1 \/ V2 - Hardware.WebHome'))
 ## Get the internal document
 #set($xwikidocument = $document.getDocument())
 #set($docExists = $xwiki.exists($xwikidocument))
 
 ## Display details on doc
 * $document || [[$document>>$xwikidocument]]
 * Exists? $docExists
 
 ## Remove it
 ##set($discard = $xwiki.getXWiki().deleteDocument($xwikidocument, false, $xcontext.context))
{{/velocity}}