Ah - I never knew about that URL publishing method - totally missed it, thanks...
I've had to solve this once for a website built and maintained by someone else - basically it means that a page's ParentID is either equal to it's own ID, or it points to a page that is in fact its descendant... I was able to pinpoint the culprit pages because suddenly the client couldn't find them in the CMS anymore, so they knew which one it was...
You could try echoing the current page's ID in the publishall() function, to see on which page it errors
cms/code/controllers/CMSMain.php ~#1291:
while($pages) {
foreach($pages as $page) {
if($page && !$page->canPublish()) return Security::permissionFailure($this);
echo "$page->ID - "; <===== THIS ONE
$page->doPublish();