• Resolved Thomas Maier

    (@webzunft)


    Hi,

    I see this error warning once per day, probably triggered by a cron job.

    PHP Fatal error:  Uncaught Piwik\Container\ContainerDoesNotExistException: The root container has not been created yet. in /wp-content/plugins/matomo/app/core/Container/StaticContainer.php:40
    Stack trace:
    #0 /wp-content/plugins/matomo/app/core/Container/StaticContainer.php(75): Piwik\Container\StaticContainer::getContainer()

    Thanks

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    @webzunft can you provide the entire stack trace (either here or by email to dizzy (at) innocraft (dot) com)?

    Thread Starter Thomas Maier

    (@webzunft)

    No problem

    PHP Fatal error:  Uncaught Piwik\Container\ContainerDoesNotExistException: The root container has not been created yet. in /wp-content/plugins/matomo/app/core/Container/StaticContainer.php:40
    Stack trace:
    #0 /wp-content/plugins/matomo/app/core/Container/StaticContainer.php(75): Piwik\Container\StaticContainer::getContainer()
    #1 /wp-content/plugins/matomo/app/core/CronArchive.php(218): Piwik\Container\StaticContainer::get()
    #2 /wp-content/plugins/matomo/classes/WpMatomo/ScheduledTasks.php(343): Piwik\CronArchive->__construct()
    #3 /wp-includes/class-wp-hook.php(322): WpMatomo\ScheduledTasks->archive()
    #4 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #5 /wp-includes/plugin.php(565): WP_Hook->do_action()
    #6 /wp-cron.php(191): do_action_ref_array()
    #7 {main}
    thrown in /wp-content/plugins/matomo/app/core/Container/StaticContainer.php on line 40
    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    @webzunft that’s strange… can you tell me how you launch the WP cron? Do you use a system cron job, and if so, can you provide the command?

    Thread Starter Thomas Maier

    (@webzunft)

    Thanks for your reply.

    I am using WP Cron, no external trigger.

    Maybe, the reason is that I am using a multisite.

    Thanks,
    Thomas

    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    That’s possible, I’ll see if I can reproduce the issue.

    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    I think having a multisite setup shouldn’t cause this issue either. Can you try updating the /path/to/wordpress/wp-content/plugins/matomo/classes/WpMatomo/Bootstrap.php file with https://raw.githubusercontent.com/matomo-org/matomo-for-wordpress/0ca7816c7249f47959e9b94199b29aefde0dd66d/classes/WpMatomo/Bootstrap.php and checking if that resolves the issue?

    If it doesn’t, can you tell me what your PHP memory limit is?

    Thread Starter Thomas Maier

    (@webzunft)

    Thanks. No new log entry today, so it seems to have worked.

    Thread Starter Thomas Maier

    (@webzunft)

    Unfortunately, I missed that my server time had a delay and the cron is running later than I checked. I now noticed, that the error was logged again today.

    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    @webzunft if you trigger the wp cron directly, via the browser, can you reproduce the issue? If you can, I’ll add some logs to try and figure out exactly what’s going on here.

    Thread Starter Thomas Maier

    (@webzunft)

    Good idea! I added wp-cron.php to both sites in the browser, but the issue was not logged.

    You can still send me the code for the logging, it will just take longer since it happens only once a day around the same time.

    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    @webzunft can you update the /path/to/wordpress/wp-content/plugins/matomo/classes/WpMatomo/Bootstrap.php file with https://raw.githubusercontent.com/matomo-org/matomo-for-wordpress/2e5904f0404a0f47add96ccae41bc354eafa1c6e/classes/WpMatomo/Bootstrap.php, then enable debug logging (both via WP_DEBUG and MATOMO_DEBUG if you have that set to false as well) ? Since we’ll have to wait to see the logs, this may result in a lot of logging data. If you don’t want to post the result here, you can email me at dizzy (at) innocraft (dot) com.

    Thread Starter Thomas Maier

    (@webzunft)

    Thanks. Email sent.

    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    @webzunft I’m not seeing the email. It doesn’t seem to have been treated as spam or blocked by a security policy either. Can you try sending it again? And if it doesn’t work, is there another way you might be able to share it?

    Thread Starter Thomas Maier

    (@webzunft)

    No problem. I double checked, and I definitely used the correct address.

    Here is the log content around the issue.

    [22-Jul-2025 12:07:24 UTC] Matomo: Scheduled tasks sync all sites and users
    [22-Jul-2025 12:07:24 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:24 UTC] Matomo: boostrapping matomo environment
    [22-Jul-2025 12:07:25 UTC] Matomo: container exists: true
    [22-Jul-2025 12:07:25 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:25 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:07:25 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:25 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo is now syncing blogId 1
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo site is known for blog (1)... will update
    [22-Jul-2025 12:07:25 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:25 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo is now syncing blogId 2
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo error syncing site: The root container has not been created yet.
    [22-Jul-2025 12:07:25 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:25 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo will now sync 2 users
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo error: The root container has not been created yet. => StaticContainer.php:40; StaticContainer.php:75; Config.php:62; Common.php:65; Model.php:50; Sync.php:200; Sync.php:94; ScheduledTasks.php:307; class-wp-hook.php:322; class-wp-hook.php:348; plugin.php:565; wp-cron.php:191;
    [22-Jul-2025 12:07:25 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:25 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo will now sync 2 users
    [22-Jul-2025 12:07:25 UTC] Matomo: Matomo error: The root container has not been created yet. => StaticContainer.php:40; StaticContainer.php:75; Config.php:62; Common.php:65; Model.php:50; Sync.php:200; Sync.php:94; ScheduledTasks.php:307; class-wp-hook.php:322; class-wp-hook.php:348; plugin.php:565; wp-cron.php:191;
    [22-Jul-2025 12:07:25 UTC] Matomo: Scheduled tasks archive data
    [22-Jul-2025 12:07:25 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:07:25 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:07:25 UTC] PHP Fatal error: Uncaught Piwik\Container\ContainerDoesNotExistException: The root container has not been created yet. in /wp-content/plugins/matomo/app/core/Container/StaticContainer.php:40
    Stack trace:
    #0 /wp-content/plugins/matomo/app/core/Container/StaticContainer.php(75): Piwik\Container\StaticContainer::getContainer()
    #1 /wp-content/plugins/matomo/app/core/CronArchive.php(218): Piwik\Container\StaticContainer::get()
    #2 /wp-content/plugins/matomo/classes/WpMatomo/ScheduledTasks.php(343): Piwik\CronArchive->__construct()
    #3 /wp-includes/class-wp-hook.php(322): WpMatomo\ScheduledTasks->archive()
    #4 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #5 /wp-includes/plugin.php(565): WP_Hook->do_action()
    #6 /wp-cron.php(191): do_action_ref_array()
    #7 {main}
    thrown in /wp-content/plugins/matomo/app/core/Container/StaticContainer.php on line 40
    [22-Jul-2025 12:10:46 UTC] Matomo: Scheduled tasks archive data
    [22-Jul-2025 12:10:46 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:46 UTC] Matomo: boostrapping matomo environment
    [22-Jul-2025 12:10:46 UTC] Matomo: container exists: true
    [22-Jul-2025 12:10:50 UTC] Matomo: Scheduled tasks sync all sites and users
    [22-Jul-2025 12:10:50 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:50 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:10:50 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:50 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:10:50 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:50 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo is now syncing blogId 1
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo error syncing site: The root container has not been created yet.
    [22-Jul-2025 12:10:50 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:50 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo is now syncing blogId 2
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo error syncing site: The root container has not been created yet.
    [22-Jul-2025 12:10:50 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:50 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo will now sync 2 users
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo error: The root container has not been created yet. => StaticContainer.php:40; StaticContainer.php:75; Config.php:62; Common.php:65; Model.php:50; Sync.php:200; Sync.php:94; ScheduledTasks.php:307; class-wp-hook.php:322; class-wp-hook.php:348; plugin.php:565; wp-cron.php:191;
    [22-Jul-2025 12:10:50 UTC] Matomo: boostrapping matomo
    [22-Jul-2025 12:10:50 UTC] Matomo: matomo already bootstrapped
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo will now sync 2 users
    [22-Jul-2025 12:10:50 UTC] Matomo: Matomo error: The root container has not been created yet. => StaticContainer.php:40; StaticContainer.php:75; Config.php:62; Common.php:65; Model.php:50; Sync.php:200; Sync.php:94; ScheduledTasks.php:307; class-wp-hook.php:322; class-wp-hook.php:348; plugin.php:565; wp-cron.php:191;
    [22-Jul-2025 12:15:14 UTC] Matomo: Apply 404 tracking changes. Blog ID: 2
    [22-Jul-2025 12:15:14 UTC] Matomo: Add tracking code. Blog ID: 2
    Plugin Support dizzyatinnocraft

    (@dizzyatinnocraft)

    @webzunft Thanks for posting that. Can you update /path/to/wordpress/wp-content/plugins/matomo/classes/WpMatomo/Bootstrap.php with https://raw.githubusercontent.com/matomo-org/matomo-for-wordpress/d8ee1f6f69d44db1d41dd2a0c5fa7c3d71bf9eb7/classes/WpMatomo/Bootstrap.php? I believe that will fix the issue (note: I removed the logs, if you want to keep them, here is the diff: https://github.com/matomo-org/matomo-for-wordpress/compare/fix-destroy-environment?expand=1).

    I’ll also try to look into why I’m not receiving your emails.

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘PHP Fatal error: Uncaught Piwik\Container\ContainerDoesNotExistException’ is closed to new replies.