# Upgrade vom 3.3.5 to 4 (latest) error: Opening segments / Opening old Emails

**URL:** <https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740>\
**Category:** Mautic 4 Install/Upgrade Support\
**Created:** [October 19, 2022, 4:42am UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740 "2022-10-19T04:42:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lanaprinzip](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lanaprinzip/32/4481_2.png) [@lanaprinzip](https://forum.mautic.org/u/lanaprinzip)\
**Post date:** [October 19, 2022, 4:42am UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740/1 "2022-10-19T04:42:47Z")

</div>

My PHP version is\* : 7.4.32  
My MySQL/MariaDB version is\* (delete as applicable): MySQL/MariaDB version: 10.3.36

I am Upgrading/installing via Command Line. It is not the live system, but a clone to test the upgrade procedure. So the original Installation is running fine on 3.3.5.

INSTALLER ERRORS:  
The upgrade went through fine. No errors reported.  
The cache was cleared.  
I also checked for outstanding migrations BEFORE and AFTER the upgrade. An older upgrade had failed once and had outstanding migrations (before this upgrade), which was corrected. The installation was stable. After this latest migration: Also no outstanding operations marked red.

THE ERROR:  
I can not open segments anymore.  
I can open old emails, statistics are not shown, nor can the email be edited.  
I can create new emails fine.

Steps I have tried to fix the problem : I ran through the standard mautic procedure: [Mautic update failed - how to recover | Mautic](https://docs.mautic.org/en/troubleshooting/update-failed)

SERVER LOG:

| 2022-10-19 06:21:25 | Error | 178.115.58.0 | 500 | GET /s/emails-graph-stats/53/0/2022-09-19/2022-10-19?\_=1666153000349&mauticUserLastActive=290&mauticLastNotificationId= HTTP/1.0 | ![https://MASKED.com/s/emails/view/53](https://MASKED.com/cp/theme/icons/16/plesk/log-browser-refer.png?1666014249) | ![Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36](https://MASKED.com/cp/theme/icons/16/plesk/log-browser-client.png?1666014249) | 54.9 K | SSL/TLS-Zugriff für Apache |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |

|2022-10-19 06:21:30|Error|178.115.58.0|500|GET /s/emails/edit/53?\_=1666153000350&mauticUserLastActive=295&mauticLastNotificationId= HTTP/1.0|

2022-10-19 06:21:22 Error 178.115.58.0 500 GET /s/segments?\_=1666153000346&mauticUserLastActive=287&mauticLastNotificationId= HTTP/1.0

MAUTIC LOG:

[2022-10-19 05:47:18] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: “An exception occurred while executing ‘SELECT COUNT(_) AS dctrn\_count FROM (SELECT DISTINCT id\_10 FROM (SELECT m0\_.is\_published AS is\_published\_0, m0\_.date\_added AS date\_added\_1, m0\_.created\_by AS created\_by\_2, m0\_.created\_by\_user AS created\_by\_user\_3, m0\_.date\_modified AS date\_modified\_4, m0\_.modified\_by AS modified\_by\_5, m0\_.modified\_by\_user AS modified\_by\_user\_6, m0\_.checked\_out AS checked\_out\_7, m0\_.checked\_out\_by AS checked\_out\_by\_8, m0\_.checked\_out\_by\_user AS checked\_out\_by\_user\_9, m0\_.id AS id\_10, m0\_.name AS name\_11, m0\_.description AS description\_12, m0\_.alias AS alias\_13, m0\_.public\_name AS public\_name\_14, m0\_.filters AS filters\_15, m0\_.is\_global AS is\_global\_16, m0\_.is\_preference\_center AS is\_preference\_center\_17, m0\_.last\_built\_date AS last\_built\_date\_18 FROM mtclead\_lists m0\_ LEFT JOIN mtccategories m1\_ ON m0\_.category\_id = m1\_.id ORDER BY m0\_.date\_modified DESC) dctrn\_result) dctrn\_table’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘m0\_.last\_built\_date’ in ‘field list’" at /var/www/MASKED.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 79 {“exception”:"[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing 'SELECT COUNT(_) AS dctrn\_count FROM (SELECT DISTINCT id\_10 FROM (SELECT m0\_.is\_published AS is\_published\_0, m0\_.date\_added AS date\_added\_1, m0\_.created\_by AS created\_by\_2, m0\_.created\_by\_user AS created\_by\_user\_3, m0\_.date\_modified AS date\_modified\_4, m0\_.modified\_by AS modified\_by\_5, m0\_.modified\_by\_user AS modified\_by\_user\_6, m0\_.checked\_out AS checked\_out\_7, m0\_.checked\_out\_by AS checked\_out\_by\_8, m0\_.checked\_out\_by\_user AS checked\_out\_by\_user\_9, m0\_.id AS id\_10, m0\_.name AS name\_11, m0\_.description AS description\_12, m0\_.alias AS alias\_13, m0\_.public\_name AS public\_name\_14, m0\_.filters AS filters\_15, m0\_.is\_global AS is\_global\_16, m0\_.is\_preference\_center AS is\_preference\_center\_17, m0\_.last\_built\_date AS last\_built\_date\_18 FROM mtclead\_lists m0\_ LEFT JOIN mtccategories m1\_ ON m0\_.category\_id = m1\_.id ORDER BY m0\_.date\_modified DESC) dctrn\_result) dctrn\_table’:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column ‘m0\_.last\_built\_date’ in ‘field list’ at /var/www/MASKED.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:79, Doctrine\DBAL\Driver\PDO\Exception(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘m0\_.last\_built\_date’ in ‘field list’ at /var/www/MASKED.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘m0\_.last\_built\_date’ in ‘field list’ at /var/www/vhosts/MASKED.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:141)”} {“hostname”:“[MASKED.com](http://MASKED.com)”,“pid”:211928}

Any help is highly appreciated.  
Thank you,  
Matthias

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [October 19, 2022, 11:41pm UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740/2 "2022-10-19T23:41:29Z")

</div>

I would start with checking migrations status again:

php bin/console doctrine:migrations:status

and comparing the entities with database schema with

php bin/console doctrine:schema:update --dump-sql

What is the output of those commands ?

---

<div class="post-metadata">

**Author:** ![lanaprinzip](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lanaprinzip/32/4481_2.png) [@lanaprinzip](https://forum.mautic.org/u/lanaprinzip)\
**Post date:** [October 20, 2022, 5:37am UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740/3 "2022-10-20T05:37:43Z")

</div>

Hi mzagmajster,  
thank you for your reply, which helped me sort the issue:

- The migration:status did not show outstanding migrations.
- I had previously run the schema check using the webend: `example.com/s/update/schema` which said, that all updates had been done.
- Now I used php bin/console doctrine:schema:update --dump-sql and saw about 30 outstanding tasks
- I updated the schema again from the command line, now it works.

Thank you so much! I would have not thought of that.  
The strange thing is, that the schema check on the webend reported it wrongly. The command line check reported it correctly.

Best,  
Matthias

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [October 20, 2022, 9:17am UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740/4 "2022-10-20T09:17:22Z")

</div>

I would always prefer CLI way of upgrading mautic over web ui. There are many additional issues you can face just because you go down Web UI path.

---

<div class="post-metadata">

**Author:** ![lanaprinzip](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lanaprinzip/32/4481_2.png) [@lanaprinzip](https://forum.mautic.org/u/lanaprinzip)\
**Post date:** [October 20, 2022, 9:29am UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740/5 "2022-10-20T09:29:36Z")

</div>

I actually upgraded using the CLI, later on, I did use the web interface (when troubleshooting) to check the schema update (as it was described like this on the Mautic Troubleshooting site). But you are right of course, the web interface for upgrading does not really work well…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [January 6, 2023, 10:13am UTC](https://forum.mautic.org/t/upgrade-vom-3-3-5-to-4-latest-error-opening-segments-opening-old-emails/25740/6 "2023-01-06T10:13:06Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
