# Can't add additional custom fields --- Alter Table Error

**URL:** https://forum.mautic.org/t/cant-add-additional-custom-fields-alter-table-error/22348
**Category:** Product Support
**Tags:** mautic-4
**Created:** [January 15, 2022, 4:41pm UTC](https://forum.mautic.org/t/cant-add-additional-custom-fields-alter-table-error/22348 "2022-01-15T16:41:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![patrickeidemiller](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/patrickeidemiller/32/511_2.png) [@patrickeidemiller](https://forum.mautic.org/u/patrickeidemiller)
#### Post date: [January 15, 2022, 4:41pm UTC](https://forum.mautic.org/t/cant-add-additional-custom-fields-alter-table-error/22348/1 "2022-01-15T16:41:27Z")

</div>

**Your software**  
My Mautic version is: v4.1.1  
My PHP version is: PHP Version 7.4.27  
My Database type and version is:

Version:  
10.3.29-MariaDB-cll-lve  
Doctrine driver  
pdo\_mysql

```
                            Doctrine database platform (automatically detected)
                            	Doctrine\DBAL\Platforms\MariaDb1027Platform

```

1. 
  - Linux [az1-ts4.a2hosting.com](http://az1-ts4.a2hosting.com) 3.10.0-962.3.2.lve1.5.52.el7.x86\_64 #1 SMP Tue Apr 13 05:36:43 EDT 2021 x86\_64

**Your problem**  
My problem is:  
When I try to add additional custom fields I get the following error and are not able to add addition custom fields.

**An exception occurred while executing ‘ALTER TABLE maup6\_leads ADD class\_device VARCHAR(255) DEFAULT NULL’: SQLSTATE[42S22]:**  
\*\* Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’\*\*

These errors are showing in the log:

–Log  
[Database info](https://xxxx.com/mautic/s/sysinfo#dbinfo)

## Current Error Log

[2022-01-14 19:17:47] mautic.NOTICE: PHP Notice - Undefined offset: 1 - in file /home/danianim/public\_html/mautic/app/bundles/LeadBundle/Views/Auditlog/details.html.php - at line 62 {“mauticTemplateVars”:{“app”:“[object] (Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables: {})”,“event”:{“eventType”:“update”,“eventLabel”:“System”,“timestamp”:“2021-10-02 11:45:04”,“details”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“contentTemplate”:“MauticLeadBundle:Auditlog:details.html.php”},“lead”:“[object] (Mautic\LeadBundle\Entity\Lead: Mautic\LeadBundle\Entity\Lead with ID #23646)”,“mauticContent”:“lead”,“mauticTemplate”:“MauticLeadBundle:Auditlog:details.html.php”,“view”:“[object] (Mautic\CoreBundle\Templating\Engine\PhpEngine: {})”},“app”:“[object] (Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables: {})”,“event”:{“eventType”:“update”,“eventLabel”:“System”,“timestamp”:“2021-10-02 11:45:04”,“details”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“contentTemplate”:“MauticLeadBundle:Auditlog:details.html.php”},“lead”:“[object] (Mautic\LeadBundle\Entity\Lead: Mautic\LeadBundle\Entity\Lead with ID #23646)”,“mauticContent”:“lead”,“mauticTemplate”:“MauticLeadBundle:Auditlog:details.html.php”,“view”:“[object] (Mautic\CoreBundle\Templating\Engine\PhpEngine: {})”,“details”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“type”:“update”,“text”:“”,“objects”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“value”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]},“key”:“tags”,“values”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]},“field”:“tags”} [2022-01-14 19:17:47] mautic.NOTICE: PHP Notice - Undefined offset: 0 - in file /home/danianim/public\_html/mautic/app/bundles/LeadBundle/Views/Auditlog/details.html.php - at line 62 {“mauticTemplateVars”:{“app”:“[object] (Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables: {})”,“event”:{“eventType”:“update”,“eventLabel”:“System”,“timestamp”:“2021-10-02 11:45:04”,“details”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“contentTemplate”:“MauticLeadBundle:Auditlog:details.html.php”},“lead”:“[object] (Mautic\LeadBundle\Entity\Lead: Mautic\LeadBundle\Entity\Lead with ID #23646)”,“mauticContent”:“lead”,“mauticTemplate”:“MauticLeadBundle:Auditlog:details.html.php”,“view”:“[object] (Mautic\CoreBundle\Templating\Engine\PhpEngine: {})”},“app”:“[object] (Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables: {})”,“event”:{“eventType”:“update”,“eventLabel”:“System”,“timestamp”:“2021-10-02 11:45:04”,“details”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“contentTemplate”:“MauticLeadBundle:Auditlog:details.html.php”},“lead”:“[object] (Mautic\LeadBundle\Entity\Lead: Mautic\LeadBundle\Entity\Lead with ID #23646)”,“mauticContent”:“lead”,“mauticTemplate”:“MauticLeadBundle:Auditlog:details.html.php”,“view”:“[object] (Mautic\CoreBundle\Templating\Engine\PhpEngine: {})”,“details”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“type”:“update”,“text”:"

Field/Object New Value Old Value

“,“objects”:{“tags”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]}},“value”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]},“key”:“tags”,“values”:{“added”:[“FC Re Invited - Missed Class”],“removed”:[“FC Missed”]},“field”:“tags”} [2022-01-14 20:45:39] mautic.WARNING: An exception occurred while executing ‘ALTER TABLE maup6\_leads ADD class\_device VARCHAR(255) DEFAULT NULL’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ [2022-01-14 20:46:28] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: “An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP foursquare’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’” at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 79 {“exception”:”[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP foursquare’:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/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 ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53)“} [2022-01-14 20:47:12] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: “An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP honeypot’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’” at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 79 {“exception”:”[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP honeypot’:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/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 ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53)“} [2022-01-14 20:47:42] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: “An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP counter’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’” at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 79 {“exception”:”[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP counter’:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/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 ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53)“} [2022-01-14 20:49:44] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: “Argument 1 passed to Mautic\LeadBundle\Model\FieldModel::getFieldSegments() must be an instance of Mautic\LeadBundle\Entity\LeadField, null given, called in /home/danianim/public\_html/mautic/app/bundles/LeadBundle/Controller/FieldController.php on line 427” at /home/danianim/public\_html/mautic/app/bundles/LeadBundle/Model/FieldModel.php line 694 {“exception”:”[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Argument 1 passed to Mautic\LeadBundle\Model\FieldModel::getFieldSegments() must be an instance of Mautic\LeadBundle\Entity\LeadField, null given, called in /home/danianim/public\_html/mautic/app/bundles/LeadBundle/Controller/FieldController.php on line 427 at /home/danianim/public\_html/mautic/app/bundles/LeadBundle/Model/FieldModel.php:694)“} [2022-01-14 20:50:26] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\InvalidFieldNameException: “An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP googleplus’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’” at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 79 {“exception”:”[object] (Doctrine\DBAL\Exception\InvalidFieldNameException(code: 0): An exception occurred while executing ‘ALTER TABLE maup6\_leads DROP googleplus’:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/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 ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ at /home/danianim/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:53)"} [2022-01-14 20:52:51] mautic.WARNING: An exception occurred while executing ‘ALTER TABLE maup6\_leads ADD class\_device VARCHAR(255) DEFAULT NULL’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ [2022-01-14 20:53:59] mautic.WARNING: An exception occurred while executing ‘ALTER TABLE maup6\_leads ADD class\_device VARCHAR(255) DEFAULT NULL’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ [2022-01-14 20:54:47] mautic.WARNING: An exception occurred while executing ‘ALTER TABLE maup6\_leads ADD class\_device VARCHAR(255) DEFAULT NULL’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’ [2022-01-15 08:21:24] mautic.WARNING: An exception occurred while executing ‘ALTER TABLE maup6\_leads ADD class\_device VARCHAR(255) DEFAULT NULL’: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘`danianim_maut458`.`l`.`email`’ in ‘GENERATED ALWAYS’

–

Steps I have tried to fix the problem:

1. Run the database repair script from here: [https://docs.mautic.org/en/troubleshooting](https://docs.mautic.org/en/troubleshooting)

### Try to fix the database schema

Go to `http://[your-mautic-url]/s/update/schema`

1. Review the database schema
2. Remove a couple of unused custom fields to ensure that there is table space to add a field.

---

<div class="post-metadata">

### Author: ![slavchob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/slavchob/32/7468_2.png) [@slavchob](https://forum.mautic.org/u/slavchob)
#### Post date: [August 14, 2022, 5:24pm UTC](https://forum.mautic.org/t/cant-add-additional-custom-fields-alter-table-error/22348/2 "2022-08-14T17:24:15Z")

</div>

i have version 4.4.1. with same problem. Is this fixed? How should i implement the fix?

---

<div class="post-metadata">

### Author: ![slavchob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/slavchob/32/7468_2.png) [@slavchob](https://forum.mautic.org/u/slavchob)
#### Post date: [August 14, 2022, 6:00pm UTC](https://forum.mautic.org/t/cant-add-additional-custom-fields-alter-table-error/22348/3 "2022-08-14T18:00:58Z")

</div>

> [@patrickeidemiller](#):
>
> /s/update/schema

the solution is here:

> [@Strange SQL Error when trying to create new custom field](https://forum.mautic.org/t/strange-sql-error-when-trying-to-create-new-custom-field/22135/2):
>
> I am also experiencing this issue with Mautic 4.2.2 Here’s my error when trying to create a select-multiple custom field: An exception occurred while executing 'ALTER TABLE leads ADD vol\_type VARCHAR(255) DEFAULT NULL': SQLSTATE[42S22]: Column not found: 1054 Unknown column '`XXXXX`.`l`.`email`' in 'GENERATED ALWAYS'
