ExpressionEngine / ExpressionEngine

ExpressionEngine is a flexible, feature-rich, free open-source content management platform that empowers hundreds of thousands of individuals and organizations around the world to easily manage their web site.

Home Page:https://expressionengine.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running conditional sync.

rbroadford opened this issue · comments

We are unable to run a conditional field sync.
EE 7.46
PHP 8.2

When try to run a conditional field sync through the admin, it says it completed the sync, but it does not. It continues to say a sync is needed.

We can see this error on the server when we run a sync though the admin:

[15/Apr/2024:12:35:41 +0000] "POST /admin.php?/cp/utilities/sync-conditional-fields/evaluate HTTP/2.0" 500 862 /admin.php?/cp/utilities/sync-conditional-fields/sync&channel_id%5B%5D=2 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" "-" 115 0.279 "862" "0.270"

It also fails when we try running it though CLI.

When we try and run it though CLI we get this error:

PHP Fatal error: Uncaught Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5281-160' for key 'exp_channel_entry_hidden_fields.PRIMARY':

INSERT INTO exp_channel_entry_hidden_fields (field_id, entry_id) VALUES (160, 5281) in /public/system/ee/legacy/database/drivers/mysqli/mysqli_connection.php:146
Stack trace:
#0 /public/system/ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('INSERT INTO ex...') #1 /public/system/ee/legacy/database/DB_driver.php(262): CI_DB_mysqli_driver->_execute('INSERT INTO ex...')
#2 /public/system/ee/legacy/database/DB_driver.php(177): CI_DB_driver->simple_query('INSERT INTO ex...') #3 /public/system/ee/legacy/database/DB_active_rec.php(1298): CI_DB_driver->query('INSERT INTO ex...')
#4 /public/system/ee/ExpressionEngine/Service/Model/Relation/HasAndBelongsToMany.php(118): CI_DB_active_record->insert('channel_entry_h...')
#5 /public/system/ee/ExpressionEngine/Service/Model/Association/Diff.php(93): ExpressionEngine\Service\Model\Relation\HasAndBelongsToMany->insert(Object(ExpressionEngine\Model\Channel\ChannelField), Array)
#6 /public/system/ee/ExpressionEngine/Service/Model/Association/Association.php(221): ExpressionEngine\Service\Model\Association\Diff->commit()
#7 /public/system/ee/ExpressionEngine/Service/Model/Model.php(379): ExpressionEngine\Service\Model\Association\Association->save()
#8 /public/system/ee/ExpressionEngine/Model/Content/FieldModel.php(141): ExpressionEngine\Service\Model\Model->save()
#9 [internal function]: ExpressionEngine\Model\Content\FieldModel->save()
#10 /public/system/ee/ExpressionEngine/Library/Data/Collection.php(79): call_user_func_array(Array, Array)
#11 [internal function]: ExpressionEngine\Library\Data\Collection->ExpressionEngine\Library\Data{closure}(Object(ExpressionEngine\Model\Channel\ChannelField))
#12 /public/system/ee/ExpressionEngine/Library/Data/Collection.php(235): array_map(Object(Closure), Array)
#13 /public/system/ee/ExpressionEngine/Library/Data/Collection.php(86): ExpressionEngine\Library\Data\Collection->map(Object(Closure))
#14 /public/system/ee/ExpressionEngine/Cli/Commands/CommandSyncConditionalFieldLogic.php(114): ExpressionEngine\Library\Data\Collection->__call('save', Array)
#15 /public/system/ee/ExpressionEngine/Cli/Cli.php(264): ExpressionEngine\Cli\Commands\CommandSyncConditionalFieldLogic->handle()
#16 /public/system/ee/ExpressionEngine/Core/Core.php(143): ExpressionEngine\Cli\Cli->process()
#17 /public/system/ee/ExpressionEngine/Core/Core.php(115): ExpressionEngine\Core\Core->bootCli()
#18 /public/system/ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#19 /public/system/ee/eecli.php(105): require_once('/srv/users/jwgm...')
#20 {main}
thrown in /public/system/ee/legacy/database/drivers/mysqli/mysqli_connection.php on line 146

@rbroadford does the field with ID 160 have multiple conditional rules attached to it? In entry 5281, do several rules make it hidden? (don't think that should be creating problem though...)

Yes, there is a conditional that will show or hide field 160 based on the selection.

Is there just one condition set for this field, or there are few?

Edit: Just a single condition.