If your WordPress admin is throwing a fatal error like count(): Argument #1 must be of type Countable|array, int given in the-events-calendar/common/src/Tribe/Error.php, it’s usually triggered while The Events Calendar is rendering an admin notice, often tied to Event Aggregator imports. Below is a quick way to get back into wp‑admin, plus a thorough fix that won’t require editing plugin files.
I’m getting a fatal error from The Events Calendar that says:
Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, int given in /wp-content/plugins/the-events-calendar/common/src/Tribe/Error.php:159
It started after updates. I use Event Aggregator and now I can’t even open some admin screens. How can I fix this?
Here’s a safe, step‑by‑step fix. Start with recovery (so you can access wp‑admin), then apply permanent steps.
wp plugin deactivate the-events-calendar wp plugin activate the-events-calendar wp plugin update the-events-calendar --force
If you use companion plugins (Events Calendar Pro, Event Tickets, Filter Bar), update them together so their “Common” library matches:
wp plugin update events-calendar-pro event-tickets --force
The error is thrown by the plugin’s error/notice system (Tribe__Error) when it tries to count() something that should be an array but isn’t. This commonly occurs while Event Aggregator is building a service message or real‑time import queue notice in the admin; a non‑array value bubbles into the error stack and triggers count() on an int.
Ensure The Events Calendar and any related Modern Tribe/TEC add‑ons are fully up to date so the shared “Common” library versions align. Mismatched versions can produce notice/queue issues.
wp plugin update the-events-calendar events-calendar-pro event-tickets --force
You can clear TEC Aggregator transients to reset limits and cached service data:
# Cautious approach: delete only TEC-related transients by key if you know them wp transient delete tribe-aggregator-limit-used_$(date +%Y%m%d) 2>/dev/null || true # Broad approach: wipe all transients if the site is a safe staging copy # wp transient delete --all
If admin notices still trigger fatals, keep imports disabled while you update/triage. You can continue with manual CSV imports as needed until a plugin update resolves the issue. Avoid editing TEC core files.
Still stuck? Pause imports, keep the public calendar visible, and consider a short professional triage, especially if this is impacting a high‑traffic events site.
WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!