unable to show custom post type featured image

Here are some thoughts :

But in your case I don’t really see why you use get_posts() most of the time we use it to get post data and make other treatments. You’d better use your own instance of WP_Query here like this :

    <?php
    $_posts = new WP_Query (

        array(
            'nopaging'  => true,
            'post_type' => 'services',
            'tax_query' => array(
                array(
                    'taxonomy' => 'service_categories',
                    'field' => 'name',
                    'terms' => $device_name,
                )
            )
        )

    );

    if ( $_posts->have_posts() ) :
        while ( $_posts->have_posts() ) : $_posts->the_post(); ?>
            <div class="devices_name_" style="cursor: pointer">
                <?php if ( has_post_thumbnail() ) : ?>
                    <div><?php the_post_thumbnail(); ?></div>
                <?php endif; ?>
                <?php the_title(); ?>
                <input type="hidden" value="<?php the_ID(); ?>" class="devices_ids_"/>
            </div>
       <?php endwhile; wp_reset_postdata();
   endif;

this way you could use functions that work within the loop. Be careful the_post_thumbnail() takes a size parameter. By default it’s “post-thumbnail” size.

error code: 523