wp_query->set for several categories

Try using tax_query:

$tax_query = array(
    'relation' => 'AND',
    array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => 1
    ),
    array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => 2
    ),
    array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => 3
    )
);
$query->set( 'tax_query', $tax_query );

error code: 523