Title: Fatal Error array count()
Last modified: March 5, 2025

---

# Fatal Error array count()

 *  Resolved [nicowebmaster](https://wordpress.org/support/users/nicowebmaster/)
 * (@nicowebmaster)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/fatal-error-array-count/)
 * Hello,
 * I have an fatal error :
 * **Fatal error**: Uncaught TypeError: count(): Argument #1 ($value) must be of
   type Countable|array, string given in /var/www/vhosts/scpld.fr/preprod.scpld.
   fr/wp-content/plugins/smartsearchwp/includes/answers/class-wdgpt-answer-generator.
   php:852 Stack trace: #0 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-content/
   plugins/smartsearchwp/includes/answers/class-wdgpt-answer-generator.php(833):
   WDGPT_Answer_Generator->wdgpt_cosine_similarity() #1 [internal function]: WDGPT_Answer_Generator-
   >{closure}() #2 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-content/plugins/
   smartsearchwp/includes/answers/class-wdgpt-answer-generator.php(831): array_map()#
   3 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-content/plugins/smartsearchwp/
   includes/answers/class-wdgpt-answer-generator.php(867): WDGPT_Answer_Generator-
   >wdgpt_calculate_similarities() #4 /var/www/vhosts/scpld.fr/preprod.scpld.fr/
   wp-content/plugins/smartsearchwp/includes/answers/class-wdgpt-answer-generator.
   php(119): WDGPT_Answer_Generator->wdgpt_sorted_similarities() #5 /var/www/vhosts/
   scpld.fr/preprod.scpld.fr/wp-content/plugins/smartsearchwp/includes/wdgpt-api-
   requests.php(181): WDGPT_Answer_Generator->wdgpt_retrieve_answer_parameters()#
   6 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-includes/rest-api/class-wp-rest-
   server.php(1292): wdgpt_retrieve_prompt() #7 /var/www/vhosts/scpld.fr/preprod.
   scpld.fr/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server-
   >respond_to_request() #8 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-includes/
   rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch() #9 /var/www/
   vhosts/scpld.fr/preprod.scpld.fr/wp-includes/rest-api.php(449): WP_REST_Server-
   >serve_request() #10 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-includes/class-
   wp-hook.php(324): rest_api_loaded() #11 /var/www/vhosts/scpld.fr/preprod.scpld.
   fr/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #12 /var/www/
   vhosts/scpld.fr/preprod.scpld.fr/wp-includes/plugin.php(565): WP_Hook->do_action()#
   13 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-includes/class-wp.php(418): do_action_ref_array()#
   14 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-includes/class-wp.php(813): WP-
   >parse_request() #15 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-includes/functions.
   php(1336): WP->main() #16 /var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-blog-header.
   php(16): wp() #17 /var/www/vhosts/scpld.fr/preprod.scpld.fr/index.php(17): require(‘…’)#
   18 {main} thrown in **/var/www/vhosts/scpld.fr/preprod.scpld.fr/wp-content/plugins/
   smartsearchwp/includes/answers/class-wdgpt-answer-generator.php** on line **852**
 * Version PHP : 8.2
 * WP 6.7.2
 * OpenAI and Licence premium key are active.
 * Thanks for your help
 * Nicolas
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffatal-error-array-count%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [nicowebmaster](https://wordpress.org/support/users/nicowebmaster/)
 * (@nicowebmaster)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/fatal-error-array-count/#post-18359113)
 * Resolution in the new version of the plugin

Viewing 1 replies (of 1 total)

The topic ‘Fatal Error array count()’ is closed to new replies.

 * ![](https://ps.w.org/smartsearchwp/assets/icon-256x256.png?rev=3002658)
 * [Chatbot with ChatGPT Wordpress](https://wordpress.org/plugins/smartsearchwp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/smartsearchwp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/smartsearchwp/)
 * [Active Topics](https://wordpress.org/support/plugin/smartsearchwp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/smartsearchwp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/smartsearchwp/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [nicowebmaster](https://wordpress.org/support/users/nicowebmaster/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/fatal-error-array-count/#post-18359113)
 * Status: resolved