Want Page Descendants when using query_posts post_parent or child_of

If you don’t have to use query_posts() then this is one method:

function my_menu() {
    global $post;

    if(!$post->post_parent){
        // will display the subpages of this top level page
        $children = wp_list_pages( array( 'title_li' => '', 'child_of' => $post->ID, 'echo' => 0 ) );
    } elseif($post->ancestors){
        // diplays only the subpages of parent level
        $ancestors = end($post->ancestors);
        $children = wp_list_pages( array( 'title_li' => '', 'child_of' => $ancestors, 'echo' => 0 ) );
    } else {
        // diplays all pages
        $children = wp_list_pages( array( 'title_li' => '', 'echo' => 0 ) );
    }

    if ($children) {
        echo '<ul id="my-menu">';
        echo $children;
        echo '</ul>';
    }

}

error code: 523