Custom filter in admin edit custom post type responding with invalid post type?

I am also get the issue same as you and finally I got the solution.

We have to add $query->is_main_query() in IF CONDITION.

if( 'trip' == $type && is_admin() && $pagenow=='edit.php' && isset($_GET['tripstatus']) && $_GET['tripstatus'] != '' && $query->is_main_query()) {

    $value = $_GET['tripstatus'];
    $query->query_vars['meta_key'] = 'trip_status';
    $query->query_vars['meta_value'] = $value;
    }

I hope it will help you to get the answer.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)