Is it an error in the post ID or in what is being returned by get_field that’s causing the issue?
The filter you have runs during an AJAX call, so it may be hard for you to see what’s going on. You can write values to your error log and then look in there.
function my_post_object_query( $args, $field, $post_id ) {
$class = get_field('class',$post_id);
error_log($post_id);
error_log($class);
// ...